From fe6d9069fc814fe445441bc9d600e6d761383cc8 Mon Sep 17 00:00:00 2001 From: mezz Date: Sat, 7 Sep 2024 14:31:23 +0900 Subject: [PATCH] add registry access to ZGatherHints --- .../org/violetmoon/zeta/event/load/ZGatherHints.java | 2 ++ .../{InfoRecipeBuilder.java => JeiGatherHints.java} | 9 +++++++-- .../org/violetmoon/zeta/integration/ZetaJeiPlugin.java | 2 +- .../zetaimplforge/event/load/ForgeZGatherHints.java | 6 +++++- 4 files changed, 15 insertions(+), 4 deletions(-) rename src/main/java/org/violetmoon/zeta/integration/{InfoRecipeBuilder.java => JeiGatherHints.java} (95%) diff --git a/src/main/java/org/violetmoon/zeta/event/load/ZGatherHints.java b/src/main/java/org/violetmoon/zeta/event/load/ZGatherHints.java index c869d80..aba4337 100644 --- a/src/main/java/org/violetmoon/zeta/event/load/ZGatherHints.java +++ b/src/main/java/org/violetmoon/zeta/event/load/ZGatherHints.java @@ -1,5 +1,6 @@ package org.violetmoon.zeta.event.load; +import net.minecraft.core.RegistryAccess; import net.minecraft.network.chat.Component; import net.minecraft.world.level.ItemLike; import org.violetmoon.zeta.config.ConfigFlagManager; @@ -17,4 +18,5 @@ public interface ZGatherHints extends IZetaLoadEvent { void gatherHintsFromModule(ZetaModule module, ConfigFlagManager cfm); + RegistryAccess getRegistryAccess(); } diff --git a/src/main/java/org/violetmoon/zeta/integration/InfoRecipeBuilder.java b/src/main/java/org/violetmoon/zeta/integration/JeiGatherHints.java similarity index 95% rename from src/main/java/org/violetmoon/zeta/integration/InfoRecipeBuilder.java rename to src/main/java/org/violetmoon/zeta/integration/JeiGatherHints.java index 6cb8c4a..cc64799 100644 --- a/src/main/java/org/violetmoon/zeta/integration/InfoRecipeBuilder.java +++ b/src/main/java/org/violetmoon/zeta/integration/JeiGatherHints.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; -class InfoRecipeBuilder implements ZGatherHints { +class JeiGatherHints implements ZGatherHints { private final IRecipeRegistration registration; private final String modId; @@ -31,7 +31,7 @@ class InfoRecipeBuilder implements ZGatherHints { private final List blacklist; private final MutableComponent externalPreamble; - public InfoRecipeBuilder(IRecipeRegistration registration, String modId, RegistryAccess registryAccess, List blacklist) { + public JeiGatherHints(IRecipeRegistration registration, String modId, RegistryAccess registryAccess, List blacklist) { this.registration = registration; this.modId = modId; this.registryAccess = registryAccess; @@ -169,4 +169,9 @@ else if (target instanceof Iterable iter) } } } + + @Override + public RegistryAccess getRegistryAccess() { + return registryAccess; + } } diff --git a/src/main/java/org/violetmoon/zeta/integration/ZetaJeiPlugin.java b/src/main/java/org/violetmoon/zeta/integration/ZetaJeiPlugin.java index 40dcc20..cfde4f4 100644 --- a/src/main/java/org/violetmoon/zeta/integration/ZetaJeiPlugin.java +++ b/src/main/java/org/violetmoon/zeta/integration/ZetaJeiPlugin.java @@ -110,7 +110,7 @@ public void registerRecipes(@NotNull IRecipeRegistration registration) { List blacklist = RegistryUtil.massRegistryGet(ZetaGeneralConfig.suppressedInfo, BuiltInRegistries.ITEM); for (Zeta z : ZetaList.INSTANCE.getZetas()) { - z.loadBus.fire(new InfoRecipeBuilder(registration, z.modid, registryAccess, blacklist), ZGatherHints.class); + z.loadBus.fire(new JeiGatherHints(registration, z.modid, registryAccess, blacklist), ZGatherHints.class); } } diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java b/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java index e589ece..ae6c311 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java +++ b/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java @@ -4,7 +4,6 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.level.ItemLike; import net.minecraftforge.eventbus.api.Event; -import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.config.ConfigFlagManager; import org.violetmoon.zeta.event.load.ZGatherHints; import org.violetmoon.zeta.module.ZetaModule; @@ -35,4 +34,9 @@ public void hintItem(ItemLike itemLike, String key, Object... extra) { public void gatherHintsFromModule(ZetaModule module, ConfigFlagManager cfm) { wrapped.gatherHintsFromModule(module, cfm); } + + @Override + public RegistryAccess getRegistryAccess() { + return wrapped.getRegistryAccess(); + } }