diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-07 07:12:36 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-07 07:12:36 +0100 |
commit | e7f3e850c9cf5ddf0f4d93a25c92d3e45a279bf6 (patch) | |
tree | c5d8cbff44428f97276eb7bd22568c3f9b02bba3 /src | |
parent | 6b253a8ac2cdb03a67f111725c263dd84532f989 (diff) | |
download | skyhanni-e7f3e850c9cf5ddf0f4d93a25c92d3e45a279bf6.tar.gz skyhanni-e7f3e850c9cf5ddf0f4d93a25c92d3e45a279bf6.tar.bz2 skyhanni-e7f3e850c9cf5ddf0f4d93a25c92d3e45a279bf6.zip |
Add Brewing Stand Overlay.
Diffstat (limited to 'src')
5 files changed, 53 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 298b01686..62ff318ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -170,6 +170,7 @@ public class SkyHanniMod { loadModule(new CompactSplashPotionMessage()); loadModule(new CroesusUnopenedChestTracker()); loadModule(new CompactBingoChat()); + loadModule(new BrewingStandOverlay()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index a47b7979e..58186b08e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -139,4 +139,9 @@ public class Misc { @ConfigOption(name = "Collection Counter Position", desc = "Tracking the number of items you collect. §cDoes not work with sacks.") @ConfigEditorButton(runnableId = "collectionCounter", buttonText = "Edit") public Position collectionCounterPos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Brewing Stand Overlay", desc = "Display the Item names directly inside the Brewing Stand") + @ConfigEditorBoolean + public boolean brewingStandOverlay = true; }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt index 30b9ad03f..7937ab2ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt @@ -5,10 +5,12 @@ import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer +import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.renderer.GlStateManager +import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -55,6 +57,8 @@ class ItemTipHelper { val gui = Minecraft.getMinecraft().currentScreen if (gui !is GuiChest) return + val chest = gui.inventorySlots as ContainerChest + var inventoryName = chest.getInventoryName() val guiLeft = (gui as AccessorGuiContainer).guiLeft val guiTop = (gui as AccessorGuiContainer).guiTop @@ -65,9 +69,8 @@ class ItemTipHelper { GlStateManager.disableBlend() for (slot in gui.inventorySlots.inventorySlots) { val stack = slot.stack ?: continue - if (stack.stackSize != 1) continue - val itemTipEvent = RenderInventoryItemTipEvent(stack) + val itemTipEvent = RenderInventoryItemTipEvent(inventoryName, slot, stack) itemTipEvent.postAndCatch() val stackTip = itemTipEvent.stackTip if (stackTip.isEmpty()) continue diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt index 4576576bd..7bb4692ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt @@ -1,8 +1,11 @@ package at.hannibal2.skyhanni.events +import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack class RenderInventoryItemTipEvent( + val inventoryName: String, + val slot: Slot, val stack: ItemStack, var stackTip: String = "", var offsetX: Int = 0, diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt new file mode 100644 index 000000000..6496e3d4c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt @@ -0,0 +1,39 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class BrewingStandOverlay { + + @SubscribeEvent + fun onRenderItemTip(event: RenderInventoryItemTipEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.misc.brewingStandOverlay) return + + if (event.inventoryName != "Brewing Stand") return + + val stack = event.stack + val name = stack.name ?: return + + when (event.slot.slotNumber) { + 13, // Ingredient input + 21, // Progress + 42, // Output right side + -> { + } + + else -> return + } + + // Hide the progress slot when not active + if (name.contains(" or ")) return + + event.stackTip = name + event.offsetX = 3 + event.offsetY = -5 + event.alignLeft = false + } +}
\ No newline at end of file |