aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/anvil
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-17 03:05:34 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-17 03:05:34 +0200
commitef58a94bf31868c4b53218474f0be04c1cd93d97 (patch)
treecb56d5969f8bebf586298475a61c521229663fda /src/main/java/at/hannibal2/skyhanni/features/anvil
parent5669dbf6f68e7cacb2df6a4e37d703df8635353e (diff)
downloadskyhanni-ef58a94bf31868c4b53218474f0be04c1cd93d97.tar.gz
skyhanni-ef58a94bf31868c4b53218474f0be04c1cd93d97.tar.bz2
skyhanni-ef58a94bf31868c4b53218474f0be04c1cd93d97.zip
moving packets around
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/anvil')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt
new file mode 100644
index 000000000..251c4e7a6
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt
@@ -0,0 +1,82 @@
+package at.hannibal2.skyhanni.features.anvil
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraft.inventory.ContainerChest
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import org.lwjgl.opengl.GL11
+
+class AnvilCombineHelper {
+
+ @SubscribeEvent
+ fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.inventory.anvilCombineHelper) return
+
+ if (event.gui !is GuiChest) return
+ val guiChest = event.gui
+ val chest = guiChest.inventorySlots as ContainerChest
+ val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
+
+ if (chestName != "Anvil") return
+
+ val matchLore = mutableListOf<String>()
+// var compareItem: ItemStack? = null
+
+ for (slot in chest.inventorySlots) {
+ if (slot == null) continue
+
+ if (slot.slotNumber != slot.slotIndex) continue
+ if (slot.stack == null) continue
+
+ if (slot.slotNumber == 29) {
+// slot highlight LorenzColor.GREEN
+ val lore = slot.stack.getLore()
+// compareItem = slot.stack
+ matchLore.addAll(lore)
+ break
+// } else if (slot.slotIndex == 29) {
+// slot highlight LorenzColor.YELLOW
+ }
+ }
+
+ val lightingState = GL11.glIsEnabled(GL11.GL_LIGHTING)
+ GlStateManager.disableLighting()
+ GlStateManager.color(1f, 1f, 1f, 1f)
+
+ if (matchLore.isEmpty()) return
+
+ for (slot in chest.inventorySlots) {
+ if (slot == null) continue
+
+ if (slot.slotNumber == slot.slotIndex) continue
+ if (slot.stack == null) continue
+
+
+ if (matchLore == slot.stack.getLore()) {
+ slot highlight LorenzColor.GREEN
+ }
+
+// if (compareItem == slot.stack) {
+// slot highlight LorenzColor.GREEN
+// } else if (compareItem.metadata == slot.stack.metadata) {
+// slot highlight LorenzColor.YELLOW
+// }
+
+// if (slot.slotNumber == 3) {
+//// slot highlight LorenzColor.GREEN
+//// } else if (slot.slotIndex == 4) {
+//// slot highlight LorenzColor.YELLOW
+//// }
+// }
+
+ if (lightingState) GlStateManager.enableLighting()
+ }
+ }
+} \ No newline at end of file