Forge 1.19.3

Created a CreativeModeTabEvent to register creative mode tabs and populate entries per tab
Moved datapack registries to DataPackRegistryEvent.NewRegistry event instead of tying them to ForgeRegistry
Made it easier for mods to datagen datapack builtin entries with DatapackBuiltinEntriesProvider
Provided access to lookupProvider for datagen
Updated dependencies to match versions used by vanilla and update JarJar to 0.3.18
Added a test mod for the new CreativeModeTabEvent
Throws better error message for Forge registries in tag datagen
Deleted ForgeRegistryTagsProvider
Updated ClientChatReceivedEvent and ServerChatEvent for Mojang changes
Added patches for both sign related methods in ModelLayers
Changed RegisterShadersEvent to use ResourceProvider
Migrated old Mojang math types to JOML

Co-authored-by: Marc Hermans <[email protected]>
Co-authored-by: LexManos <[email protected]>
Co-authored-by: sciwhiz12 <[email protected]>
Co-authored-by: coehlrich <[email protected]>
This commit is contained in:
committed 2022-12-08 01:45:22 -06:00
1 parent 617ecb7ad3
commit 8255d7aed3
726 files changed
+7615 -6653

No files matched your search

@@ -0,0 +1,78 @@
package net.minecraftforge.client;
import java.util.IdentityHashMap;
import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.searchtree.SearchRegistry;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.CreativeModeTabRegistry;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
public class CreativeModeTabSearchRegistry
{
private static final Map<CreativeModeTab, SearchRegistry.Key<ItemStack>> NAME_SEARCH_KEYS = new IdentityHashMap<>();
private static final Map<CreativeModeTab, SearchRegistry.Key<ItemStack>> TAG_SEARCH_KEYS = new IdentityHashMap<>();
public static Map<CreativeModeTab, SearchRegistry.Key<ItemStack>> getNameSearchKeys() {
Map<CreativeModeTab, SearchRegistry.Key<ItemStack>> nameSearchKeys = new IdentityHashMap<>();
nameSearchKeys.put(CreativeModeTabs.searchTab(), getNameSearchKey(CreativeModeTabs.searchTab()));
for (CreativeModeTab tab : CreativeModeTabRegistry.getSortedCreativeModeTabs())
{
SearchRegistry.Key<ItemStack> nameSearchKey = getNameSearchKey(tab);
if (nameSearchKey != null)
nameSearchKeys.put(tab, nameSearchKey);
}
return nameSearchKeys;
}
public static Map<CreativeModeTab, SearchRegistry.Key<ItemStack>> getTagSearchKeys() {
Map<CreativeModeTab, SearchRegistry.Key<ItemStack>> tagSearchKeys = new IdentityHashMap<>();
tagSearchKeys.put(CreativeModeTabs.searchTab(), getTagSearchKey(CreativeModeTabs.searchTab()));
for (CreativeModeTab tab : CreativeModeTabRegistry.getSortedCreativeModeTabs())
{
SearchRegistry.Key<ItemStack> tagSearchKey = getTagSearchKey(tab);
if (tagSearchKey != null)
tagSearchKeys.put(tab, tagSearchKey);
}
return tagSearchKeys;
}
@Nullable
public static SearchRegistry.Key<ItemStack> getNameSearchKey(CreativeModeTab tab)
{
if (tab == CreativeModeTabs.searchTab())
return SearchRegistry.CREATIVE_NAMES;
if (!tab.hasSearchBar())
return null;
return NAME_SEARCH_KEYS.computeIfAbsent(tab, k -> new SearchRegistry.Key<>());
}
@Nullable
public static SearchRegistry.Key<ItemStack> getTagSearchKey(CreativeModeTab tab)
{
if (tab == CreativeModeTabs.searchTab())
return SearchRegistry.CREATIVE_TAGS;
if (!tab.hasSearchBar())
return null;
return TAG_SEARCH_KEYS.computeIfAbsent(tab, k -> new SearchRegistry.Key<>());
}
// We do it this way to prevent unwanted classloading
@ApiStatus.Internal
public static void createSearchTrees() {
Minecraft.getInstance().createSearchTrees();
}
}