diff --git a/build.gradle b/build.gradle index e12c9d3..646152d 100644 --- a/build.gradle +++ b/build.gradle @@ -124,33 +124,18 @@ configurations { } dependencies { - // Example optional mod dependency with JEI - // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime - // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" - // compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}" - // We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it - // localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}" - - // Example mod dependency using a mod jar from ./libs with a flat dir repository - // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar - // The group id is ignored when searching -- in this case, it is "blank" - // implementation "blank:coolmod-${mc_version}:${coolmod_version}" - + jarJar(group: 'dev.xkmc', name: 'l2tabs', version: '[3.0.5+7,)') + implementation "dev.xkmc:l2tabs:3.0.5+7" + jarJar(group: 'dev.xkmc', name: 'l2menustacker', version: '[3.0.9,)') + implementation "dev.xkmc:l2menustacker:3.0.9" + jarJar(group: 'dev.xkmc', name: 'l2serial', version: '[3.0.9+5,)') + implementation "dev.xkmc:l2serial:3.0.9+5" + jarJar(group: 'dev.xkmc', name: 'l2library', version: '[3.0.2+7,)') + implementation "dev.xkmc:l2library:3.0.2+7" + jarJar(group: 'dev.xkmc', name: 'l2core', version: '[3.0.7+45,)') + implementation "dev.xkmc:l2core:3.0.7+45" implementation files("libs/EclipticSeasons-1.21-neoforge-0.4.1-beta.jar") - - //implementation "com.tterrag.registrate:Registrate:MC1.21-1.3.0+50" - - //jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: "[MC1.21,MC1.22)") - - // Example mod dependency using a file as dependency - // implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar") - - // Example project dependency using a sister or child project: - // implementation project(":myproject") - - // For more info: - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html + implementation "com.tterrag.registrate:Registrate:MC1.21-1.3.0+55" } // This block of code expands all declared replace properties in the specified resource targets. diff --git a/gradle.properties b/gradle.properties index 8410afe..3c84512 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,15 +12,15 @@ parchment_mappings_version=2024.07.07 # Environment Properties # You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge # The Minecraft version must agree with the Neo version to get a valid artifact -minecraft_version=1.21 +minecraft_version=1.21.1 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.21,1.21.2) +minecraft_version_range=[1.21.1,1.21.2) # The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=21.0.114-beta +neo_version=21.1.24 # The Neo version range can use any version of Neo as bounds -neo_version_range=[21.0.0-beta,) +neo_version_range=[21.1.0-beta,) # The loader version range can only use the major version of FML as bounds loader_version_range=[4,) diff --git a/libs/l2core-3.0.7+45.jar b/libs/l2core-3.0.7+45.jar new file mode 100644 index 0000000..a500bce Binary files /dev/null and b/libs/l2core-3.0.7+45.jar differ diff --git a/libs/l2library-3.0.2+7.jar b/libs/l2library-3.0.2+7.jar new file mode 100644 index 0000000..c840760 Binary files /dev/null and b/libs/l2library-3.0.2+7.jar differ diff --git a/libs/l2menustacker-3.0.9.jar b/libs/l2menustacker-3.0.9.jar new file mode 100644 index 0000000..0b09ffc Binary files /dev/null and b/libs/l2menustacker-3.0.9.jar differ diff --git a/libs/l2serial-3.0.9+5.jar b/libs/l2serial-3.0.9+5.jar new file mode 100644 index 0000000..d159647 Binary files /dev/null and b/libs/l2serial-3.0.9+5.jar differ diff --git a/libs/l2tabs-3.0.5+7.jar b/libs/l2tabs-3.0.5+7.jar new file mode 100644 index 0000000..fc0b2ad Binary files /dev/null and b/libs/l2tabs-3.0.5+7.jar differ diff --git a/src/main/java/org/hiedacamellia/whispergrove/content/client/screen/VisceraScreen.java b/src/main/java/org/hiedacamellia/whispergrove/content/client/screen/VisceraScreen.java deleted file mode 100644 index 89a6291..0000000 --- a/src/main/java/org/hiedacamellia/whispergrove/content/client/screen/VisceraScreen.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.hiedacamellia.whispergrove.content.client.screen; - -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.player.Inventory; -import org.hiedacamellia.whispergrove.content.client.menu.VisceraMenu; - -public class VisceraScreen extends AbstractContainerScreen { - - public VisceraScreen(VisceraMenu menu, Inventory playerInventory, Component title) { - super(menu, playerInventory, title); - } - - @Override - protected void renderBg(GuiGraphics guiGraphics, float v, int i, int i1) { - - } -} diff --git a/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/ViscerEntry.java b/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/ViscerEntry.java new file mode 100644 index 0000000..50ab688 --- /dev/null +++ b/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/ViscerEntry.java @@ -0,0 +1,44 @@ +package org.hiedacamellia.whispergrove.content.client.tab; + +import com.mojang.datafixers.util.Pair; +import dev.xkmc.l2library.util.TextWrapper; +import net.minecraft.client.Minecraft; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.FormattedCharSequence; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import org.hiedacamellia.whispergrove.WhisperGrove; +import org.hiedacamellia.whispergrove.api.viscera.VisceraHolder; +import org.hiedacamellia.whispergrove.content.viscera.*; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + +public record ViscerEntry( + List hover, + Component content, + ResourceLocation icon +){ + + public static List aggregate(@Nullable Player le) { + if (le == null) return List.of(); + List raw = new ArrayList<>(); + + raw.add(new ViscerEntry(HeartEvent.getHover(le), HeartEvent.getdesc(le), + WhisperGrove.prefix("textures/viscera/heart.png"))); + raw.add(new ViscerEntry(KidneyEvent.getHover(le), KidneyEvent.getdesc(le), + WhisperGrove.prefix("textures/viscera/kidney.png"))); + raw.add(new ViscerEntry(LiverEvent.getHover(le), LiverEvent.getdesc(le), + WhisperGrove.prefix("textures/viscera/liver.png"))); + raw.add(new ViscerEntry(LungEvent.getHover(le), LungEvent.getdesc(le), + WhisperGrove.prefix("textures/viscera/lung.png"))); + raw.add(new ViscerEntry(SpleenEvent.getHover(le), SpleenEvent.getdesc(le), + WhisperGrove.prefix("textures/viscera/spleen.png"))); + + return raw; + } + +} 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 new file mode 100644 index 0000000..64b8e23 --- /dev/null +++ b/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraScreen.java @@ -0,0 +1,71 @@ +package org.hiedacamellia.whispergrove.content.client.tab; + +import dev.xkmc.l2core.util.Proxy; +import dev.xkmc.l2tabs.tabs.contents.BaseTextScreen; +import dev.xkmc.l2tabs.tabs.core.TabManager; +import dev.xkmc.l2tabs.tabs.inventory.InvTabData; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import org.hiedacamellia.whispergrove.core.debug.Debug; +import org.hiedacamellia.whispergrove.registers.WGTab; + +import java.util.List; +import java.util.Optional; + +public class VisceraScreen extends BaseTextScreen { + + private final int page; + + protected VisceraScreen(Component title) { + this(title, 0); + } + + protected VisceraScreen(Component title, int page) { + super(title, ResourceLocation.fromNamespaceAndPath("l2tabs", "textures/gui/empty.png")); + this.page = page; + } + + @Override + public void init() { + super.init(); + new TabManager<>(this, new InvTabData()).init(this::addRenderableWidget, WGTab.TAB_VISCERA.get()); + } + + + @Override + public void render(GuiGraphics g, int mx, int my, float ptick) { + super.render(g, mx, my, ptick); + Player player = Proxy.getClientPlayer(); + int x = leftPos + 8; + int y = topPos + 6; + var all = ViscerEntry.aggregate(player); + //Debug.getLogger().debug("all: " + all); + List hover = null; + Font font = Minecraft.getInstance().font; + for (var pair : all) { + //Debug.getLogger().debug("pair: " + pair); + int index = all.indexOf(pair); + g.blit(pair.icon(), x , y+ index*32, 0, 0, 16, 16, 16, 16); + g.drawString(font, pair.content().getString(), x, y + index*32 +16, 0,false); + + //Debug.getLogger().debug("pair: " + pair); + int row = y + index * 32 +16; + int column = x; + int rowAft = y + index * 32 + 26; + int columnAft = x + font.width(pair.content()); + if (my >= row && my < rowAft && mx >= column && mx < columnAft) { + hover = pair.hover(); + } + + } + if (hover != null) { + g.renderTooltip(font, hover, Optional.empty(), mx, my); + } + } + + +} diff --git a/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraTab.java b/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraTab.java new file mode 100644 index 0000000..1e11134 --- /dev/null +++ b/src/main/java/org/hiedacamellia/whispergrove/content/client/tab/VisceraTab.java @@ -0,0 +1,31 @@ +package org.hiedacamellia.whispergrove.content.client.tab; + +import dev.xkmc.l2tabs.init.L2Tabs; +import dev.xkmc.l2tabs.tabs.core.TabBase; +import dev.xkmc.l2tabs.tabs.core.TabManager; +import dev.xkmc.l2tabs.tabs.core.TabToken; +import dev.xkmc.l2tabs.tabs.inventory.InvTabData; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import org.hiedacamellia.whispergrove.registers.WGItem; + +public class VisceraTab extends TabBase { + public VisceraTab(int index, TabToken token, TabManager manager, Component title) { + super(index, token, manager, title); + } + + @Override + public void onTabClicked() { + Minecraft.getInstance().setScreen(new VisceraScreen(this.getMessage())); + } + + @Override + protected void renderIcon(GuiGraphics g) { + ItemStack stack = WGItem.BAMBOO_LEAF.toStack(); + if (!stack.isEmpty()) { + this.token.getType().drawIcon(g, this.getX(), this.getY(), stack); + } + } +} diff --git a/src/main/java/org/hiedacamellia/whispergrove/core/recipe/generalprescriptprocess/GeneralPrescriptProcessInput.java b/src/main/java/org/hiedacamellia/whispergrove/core/recipe/generalprescriptprocess/GeneralPrescriptProcessInput.java index 75df942..8e01f2a 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/core/recipe/generalprescriptprocess/GeneralPrescriptProcessInput.java +++ b/src/main/java/org/hiedacamellia/whispergrove/core/recipe/generalprescriptprocess/GeneralPrescriptProcessInput.java @@ -15,7 +15,7 @@ public ItemStack getItem(int slot) { @Override public int size() { - return 10; + return 9; } } \ No newline at end of file diff --git a/src/main/java/org/hiedacamellia/whispergrove/registers/WGScreen.java b/src/main/java/org/hiedacamellia/whispergrove/registers/WGScreen.java index bba793d..c9fc05d 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/registers/WGScreen.java +++ b/src/main/java/org/hiedacamellia/whispergrove/registers/WGScreen.java @@ -6,14 +6,13 @@ import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; import org.hiedacamellia.whispergrove.WhisperGrove; import org.hiedacamellia.whispergrove.content.client.screen.SpringingScreen; -import org.hiedacamellia.whispergrove.content.client.screen.VisceraScreen; +import org.hiedacamellia.whispergrove.content.client.tab.VisceraScreen; @EventBusSubscriber(modid = WhisperGrove.MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class WGScreen { @SubscribeEvent public static void clientLoad(RegisterMenuScreensEvent event) { - event.register(WGMenu.VISCERA.get(), VisceraScreen::new); event.register(WGMenu.SPRINGING.get(), SpringingScreen::new); } diff --git a/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java b/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java index 05b7ee3..e52a7b7 100644 --- a/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java +++ b/src/main/java/org/hiedacamellia/whispergrove/registers/WGTab.java @@ -1,5 +1,9 @@ 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.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.CreativeModeTab; @@ -7,6 +11,9 @@ import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; import org.hiedacamellia.whispergrove.WhisperGrove; +import org.hiedacamellia.whispergrove.content.client.tab.VisceraTab; + +import static dev.xkmc.l2tabs.init.L2Tabs.TAB_REG; public class WGTab { @@ -19,4 +26,7 @@ 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