From 48db6d549a31c14d44d6086fc73f29790dfcbe91 Mon Sep 17 00:00:00 2001 From: Yuqi154 <1123489751@qq.com> Date: Sat, 19 Oct 2024 21:23:06 +0800 Subject: [PATCH] fix --- .../content/client/tab/VisceraScreen.java | 3 ++- .../whispergrove/registers/WGClientTab.java | 19 +++++++++++++++++++ .../whispergrove/registers/WGTab.java | 5 ++--- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/hiedacamellia/whispergrove/registers/WGClientTab.java diff --git a/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraScreen.java b/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraScreen.java index 64b8e23..0b2b46c 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraScreen.java +++ b/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraScreen.java @@ -11,6 +11,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import org.hiedacamellia.whispergrove.core.debug.Debug; +import org.hiedacamellia.whispergrove.registers.WGClientTab; import org.hiedacamellia.whispergrove.registers.WGTab; import java.util.List; @@ -32,7 +33,7 @@ protected VisceraScreen(Component title, int page) { @Override public void init() { super.init(); - new TabManager<>(this, new InvTabData()).init(this::addRenderableWidget, WGTab.TAB_VISCERA.get()); + new TabManager<>(this, new InvTabData()).init(this::addRenderableWidget, WGClientTab.TAB_VISCERA.get()); } diff --git a/src/main/java/org/hiedacamellia/whispergrove/registers/WGClientTab.java b/src/main/java/org/hiedacamellia/whispergrove/registers/WGClientTab.java new file mode 100644 index 0000000..9fb9d84 --- /dev/null +++ b/src/main/java/org/hiedacamellia/whispergrove/registers/WGClientTab.java @@ -0,0 +1,19 @@ +package org.hiedacamellia.whispergrove.registers; + +import dev.xkmc.l2core.init.reg.simple.Val; +import dev.xkmc.l2tabs.init.L2Tabs; +import dev.xkmc.l2tabs.tabs.core.TabToken; +import dev.xkmc.l2tabs.tabs.inventory.InvTabData; +import net.minecraft.network.chat.Component; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import org.hiedacamellia.whispergrove.content.client.tab.VisceraTab; + +import static dev.xkmc.l2tabs.init.L2Tabs.TAB_REG; + +@OnlyIn(Dist.CLIENT) +public class WGClientTab { + public static Val> TAB_VISCERA = TAB_REG.reg("viscera_tab", + () -> L2Tabs.GROUP.registerTab(() -> VisceraTab::new, + Component.translatable("menu.whispergrove.viscera_tab"))); +} diff --git a/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java b/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java index e52a7b7..ac8932d 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java +++ b/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java @@ -8,6 +8,8 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTabs; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; import org.hiedacamellia.whispergrove.WhisperGrove; @@ -26,7 +28,4 @@ public class WGTab { WGItem.ITEMS.getEntries().forEach(holder -> output.accept(holder.get())); }).build()); - public static Val> TAB_VISCERA = TAB_REG.reg("viscera_tab", - () -> L2Tabs.GROUP.registerTab(() -> VisceraTab::new, - Component.translatable("menu.whispergrove.viscera_tab"))); } \ No newline at end of file