diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
4 files changed, 98 insertions, 18 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 index 251c4e7a6..b2d397714 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt @@ -7,10 +7,8 @@ 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 { @@ -46,10 +44,6 @@ class AnvilCombineHelper { } } - val lightingState = GL11.glIsEnabled(GL11.GL_LIGHTING) - GlStateManager.disableLighting() - GlStateManager.color(1f, 1f, 1f, 1f) - if (matchLore.isEmpty()) return for (slot in chest.inventorySlots) { @@ -75,8 +69,6 @@ class AnvilCombineHelper { //// slot highlight LorenzColor.YELLOW //// } // } - - if (lightingState) GlStateManager.enableLighting() } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt index 893a356c4..31bc1e978 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt @@ -7,10 +7,8 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor 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 BazaarOrderHelper { @@ -29,11 +27,7 @@ class BazaarOrderHelper { val guiChest = event.gui val chest = guiChest.inventorySlots as ContainerChest val inventoryName = chest.lowerChestInventory.displayName.unformattedText.trim() - if (!isBazaarOrderInventory(inventoryName)) return - val lightingState = GL11.glIsEnabled(GL11.GL_LIGHTING) - GlStateManager.disableLighting() - GlStateManager.color(1f, 1f, 1f, 1f) out@ for (slot in chest.inventorySlots) { if (slot == null) continue @@ -71,7 +65,5 @@ class BazaarOrderHelper { } } } - - if (lightingState) GlStateManager.enableLighting() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt index a96632d74..cee707155 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt @@ -94,7 +94,7 @@ class HideNotClickableItems { val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() val stack = event.itemStack - if (ItemUtils.getItemsInOpenChest().contains(stack)) return + if (ItemUtils.getItemsInOpenChest().map { it.stack }.contains(stack)) return if (!ItemUtils.getItemsInInventory().contains(stack)) return if (hide(chestName, stack)) { @@ -104,7 +104,7 @@ class HideNotClickableItems { event.toolTip.add("") if (hideReason == "") { event.toolTip.add("§4No hide reason!") - LorenzUtils.warning("Not hide reason for not clickable item!") + LorenzUtils.warning("No hide reason for not clickable item!") } else { event.toolTip.add("§c$hideReason") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt new file mode 100644 index 000000000..1c0c4cfb5 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt @@ -0,0 +1,96 @@ +package at.hannibal2.skyhanni.features.items + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.GuiRenderItemEvent +import at.hannibal2.skyhanni.utils.ItemUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.between +import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +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 + +class RngMeterInventory { + + @SubscribeEvent + fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Post) { + if (!LorenzUtils.inSkyblock) return + + val screen = Minecraft.getMinecraft().currentScreen + if (screen !is GuiChest) return + val chest = screen.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + var stackTip = "" + + val stack = event.stack ?: return + if (SkyHanniMod.feature.inventory.rngMeterFloorName) { + if (chestName == "Catacombs RNG Meter") { + val name = stack.name ?: return + if (name.removeColor() == "RNG Meter") { + stackTip = stack.getLore()[0].between("(", ")") + } + } + } + + + if (stackTip.isNotEmpty()) { + GlStateManager.disableLighting() + GlStateManager.disableDepth() + GlStateManager.disableBlend() + event.fontRenderer.drawStringWithShadow( + stackTip, + (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(), + (event.y + 9).toFloat(), + 16777215 + ) + GlStateManager.enableLighting() + GlStateManager.enableDepth() + } + } + + @SubscribeEvent(priority = EventPriority.LOW) + fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { + if (!LorenzUtils.inSkyblock) 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 (SkyHanniMod.feature.inventory.rngMeterNoDrop) { + if (chestName == "Catacombs RNG Meter") { + for (slot in ItemUtils.getItemsInOpenChest()) { + val stack = slot.stack + if (stack.getLore().any { it.contains("You don't have an RNG drop") }) { + slot highlight LorenzColor.RED +// val color = LorenzColor.RED.addOpacity(160) +// slot.stack.background = color.rgb + //TODO use other coloring logic + } + } + } + } + + if (SkyHanniMod.feature.inventory.rngMeterSelectedDrop) { + if (chestName.endsWith(" RNG Meter")) { + for (slot in ItemUtils.getItemsInOpenChest()) { + val stack = slot.stack + if (stack.getLore().any { it.contains("§aSELECTED") }) { + slot highlight LorenzColor.YELLOW +// val color = LorenzColor.YELLOW.addOpacity(160) +// slot.stack.background = color.rgb + } + } + } + } + } +}
\ No newline at end of file |
