diff --git a/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java b/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java index d84e52434..d08bf6d58 100644 --- a/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java +++ b/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.api.tag; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.util.function.Supplier; import net.minecraft.block.Block; @@ -53,35 +51,10 @@ public final class TagRegistry { } public static Tag fluid(Identifier id) { - return create(id, TagRegistry::getFluidTagContainer); + return create(id, FluidTags::getContainer); } public static Tag item(Identifier id) { return create(id, ItemTags::getContainer); } - - private static Field fluidTagContainer; - - private static TagContainer getFluidTagContainer() { - if (fluidTagContainer == null) { - for (Field f : FluidTags.class.getDeclaredFields()) { - if ((f.getModifiers() & Modifier.STATIC) != 0 && f.getType() == TagContainer.class) { - f.setAccessible(true); - fluidTagContainer = f; - break; - } - } - - if (fluidTagContainer == null) { - throw new RuntimeException("Could not find FluidTags.container!"); - } - } - - try { - //noinspection unchecked - return (TagContainer) fluidTagContainer.get(null); - } catch (IllegalAccessException e) { - throw new RuntimeException("Could not access FluidTags.container (" + fluidTagContainer.getName() + ")!", e); - } - } }