aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
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/data/ItemRenderBackground.kt
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/data/ItemRenderBackground.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
new file mode 100644
index 000000000..bff39fc8c
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt
@@ -0,0 +1,47 @@
+package at.hannibal2.skyhanni.data
+
+import at.hannibal2.skyhanni.events.RenderRealOverlayEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.Gui
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraft.item.ItemStack
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class ItemRenderBackground {
+
+ companion object {
+
+ val map = mutableMapOf<ItemStack, Int>()
+ val mapTime = mutableMapOf<ItemStack, Long>()
+
+ var ItemStack.background: Int
+ get() {
+ if (System.currentTimeMillis() > mapTime.getOrDefault(this, 0) + 100) return -1
+ return map.getOrDefault(this, -1)
+ }
+ set(value) {
+ map[this] = value
+ mapTime[this] = System.currentTimeMillis()
+ }
+ }
+
+
+ @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()
+ }
+ }
+ }
+ }
+} \ No newline at end of file