From 7c0c1b2935b7edaabd5efa12ef23ede0365c1d5b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:46:57 +0100 Subject: Adding green line around items that are clickable. --- .../skyhanni/data/ItemRenderBackground.kt | 57 ++++++++++++++++------ 1 file changed, 41 insertions(+), 16 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt') diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt index 1576ff4ca..bdbb86c31 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt @@ -12,16 +12,27 @@ class ItemRenderBackground { companion object { - private val mapColor = mutableMapOf() + private val backgroundColor = mutableMapOf() + private val borderLineColor = mutableMapOf() private val mapTime = mutableMapOf() var ItemStack.background: Int get() { - if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 200) return -1 - return mapColor.getOrDefault(this, -1) + if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 60) return -1 + return backgroundColor.getOrDefault(this, -1) } set(value) { - mapColor[this] = value + backgroundColor[this] = value + mapTime[this] = System.currentTimeMillis() + } + + var ItemStack.borderLine: Int + get() { + if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 60) return -1 + return borderLineColor.getOrDefault(this, -1) + } + set(value) { + borderLineColor[this] = value mapTime[this] = System.currentTimeMillis() } } @@ -30,18 +41,32 @@ class ItemRenderBackground { @SubscribeEvent fun renderOverlayLol(event: RenderRealOverlayEvent) { val stack = event.stack - if (LorenzUtils.inSkyBlock) { - if (stack != null) { - val color = stack.background - if (color != -1) { - GlStateManager.pushMatrix() - GlStateManager.translate(0f, 0f, 110 + Minecraft.getMinecraft().renderItem.zLevel) - val x = event.x - val y = event.y - Gui.drawRect(x, y, x + 16, y + 16, color) - GlStateManager.popMatrix() - } - } + if (!LorenzUtils.inSkyBlock) return + if (stack == null) return + + val backgroundColor = stack.background + if (backgroundColor != -1) { + GlStateManager.pushMatrix() + GlStateManager.translate(0f, 0f, 110 + Minecraft.getMinecraft().renderItem.zLevel) + val x = event.x + val y = event.y + Gui.drawRect(x, y, x + 16, y + 16, backgroundColor) + GlStateManager.popMatrix() + } + + val borderLineColor = stack.borderLine + if (borderLineColor != -1) { + GlStateManager.pushMatrix() + GlStateManager.translate(0f, 0f, 110 + Minecraft.getMinecraft().renderItem.zLevel) + val x = event.x + val y = event.y + + Gui.drawRect(x, y, x + 1, y + 16, borderLineColor) + Gui.drawRect(x, y, x + 16, y + 1, borderLineColor) + + Gui.drawRect(x, y + 15, x + 16, y + 16, borderLineColor) + Gui.drawRect(x + 15, y, x + 16, y + 16, borderLineColor) + GlStateManager.popMatrix() } } } \ No newline at end of file -- cgit