[1.18.2] Fix tags for custom forge registries. (#8495)

Tag-enabled registries must now be registered to vanilla's root registry. See RegistryBuilder#hasTags.
Modded tag-enabled registries have to use the format `data/<namespace>/tags/<registrynamespace>/<registryname>/<tag>.json`
This format is to prevent conflicts for registries with the same path but different namespaces
EX: Registry name `examplemod:shoe`, tag name `blue_shoes` would be `data/<namespace>/tags/examplemod/shoe/blue_shoes.json`
RegistryEvent.NewRegistry has been moved and renamed to NewRegistryEvent.
RegistryBuilder#create has been made private. See NewRegistryEvent#create
Created new ITagManager system for looking up Forge tags. See IForgeRegistry#tags.
Add lookup methods for Holders from forge registries. See IForgeRegistry#getHolder.
This commit is contained in:
SizableShrimp authored and GitHub committed 2022-03-16 13:36:00 -07:00
1 parent 30f3a7dbba
commit ad75cb8644
51 files changed
+1621 -531

No files matched your search

@@ -17,7 +17,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.IModBusEvent;
import net.minecraftforge.registries.RegistryBuilder;
import org.apache.commons.lang3.Validate;
import com.google.common.collect.ImmutableList;
@@ -27,7 +26,6 @@ import net.minecraftforge.eventbus.api.GenericEvent;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
/**
* RegistryEvent supertype.
*/
@@ -36,17 +34,6 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
RegistryEvent(Class<T> clazz) {
super(clazz);
}
/**
* Register new registries when you receive this event, through the {@link RegistryBuilder}
*/
public static class NewRegistry extends net.minecraftforge.eventbus.api.Event implements IModBusEvent
{
public NewRegistry(ModContainer mc) {}
@Override
public String toString() {
return "RegistryEvent.NewRegistry";
}
}
/**
* Register your objects for the appropriate registry type when you receive this event.