From 644c3f591d42d91c8445b199202b37ba05b0bf93 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 17 Sep 2024 21:36:09 +0800 Subject: Use InstanceHelper to get registryAccess --- api/src/main/java/me/shedaniel/rei/impl/Internals.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'api/src/main/java/me/shedaniel/rei/impl/Internals.java') diff --git a/api/src/main/java/me/shedaniel/rei/impl/Internals.java b/api/src/main/java/me/shedaniel/rei/impl/Internals.java index 112b030ce..bcbfcc7fb 100644 --- a/api/src/main/java/me/shedaniel/rei/impl/Internals.java +++ b/api/src/main/java/me/shedaniel/rei/impl/Internals.java @@ -35,6 +35,7 @@ import me.shedaniel.rei.api.common.plugins.REIPlugin; import me.shedaniel.rei.api.common.plugins.REIServerPlugin; import me.shedaniel.rei.api.common.transfer.info.MenuInfoRegistry; import me.shedaniel.rei.impl.common.InternalLogger; +import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Unit; @@ -55,6 +56,7 @@ public final class Internals { private static Function> categoryIdentifier = (object) -> throwNotSetup(); private static Supplier stubMenuInfoRegistry = Internals::throwNotSetup; private static Supplier logger = Internals::throwNotSetup; + private static Supplier registryAccess = Internals::throwNotSetup; private static T throwNotSetup() { throw new AssertionError("REI Internals have not been initialized!"); @@ -117,6 +119,10 @@ public final class Internals { return logger.get(); } + public static RegistryAccess getRegistryAccess() { + return registryAccess.get(); + } + public interface EntryStackProvider { EntryStack empty(); -- cgit