aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt41
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt22
3 files changed, 43 insertions, 45 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt
index 61bd56198..b62f86d85 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt
@@ -1,15 +1,13 @@
package at.hannibal2.skyhanni.features.garden.contest
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.GuiContainerEvent
-import at.hannibal2.skyhanni.events.InventoryCloseEvent
-import at.hannibal2.skyhanni.events.InventoryUpdatedEvent
-import at.hannibal2.skyhanni.events.LorenzToolTipEvent
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.InventoryUtils
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.RenderUtils
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
@@ -18,7 +16,6 @@ import java.text.SimpleDateFormat
import java.util.*
class JacobFarmingContestsInventory {
-
private val duplicateSlots = mutableListOf<Int>()
private val realTime = mutableMapOf<Int, String>()
@@ -28,6 +25,7 @@ class JacobFarmingContestsInventory {
// Render the contests a tick delayed to feel smoother
private var hideEverything = true
+ private val contestEarnedPattern = "§7You earned a §(?<medalColour>.*)§l.* §7medal!".toPattern()
@SubscribeEvent
fun onInventoryClose(event: InventoryCloseEvent) {
@@ -142,4 +140,37 @@ class JacobFarmingContestsInventory {
}
}
}
+
+ @SubscribeEvent
+ fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!config.jacobFarmingContestMedalIcon) return
+ if (!InventoryUtils.openInventoryName().contains("Your Contests")) return
+
+ val stack = event.stack ?: return
+ var finneganContest = false
+
+ for (line in stack.getLore()) {
+ if (line.contains("Contest boosted by Finnegan!")) finneganContest = true
+
+ val matcher = contestEarnedPattern.matcher(line)
+ if (matcher.matches()) {
+ val medalEarned = ContestBracket.entries.find { it.color == matcher.group("medalColour") } ?: return
+
+ var stackTip = "§${medalEarned.color}✦"
+ var x = event.x + 9
+ var y = event.y + 1
+ var scale = .7f
+
+ if (finneganContest && config.jacobFarmingContestFinneganIcon) {
+ stackTip = "§${medalEarned.color}▲"
+ x = event.x + 5
+ y = event.y - 2
+ scale = 1.3f
+ }
+
+ RenderUtils.drawSlotText(x, y, stackTip, scale)
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt
index 5cfcd881d..ea3246ac5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt
@@ -3,8 +3,8 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiRenderItemEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetCandyUsed
-import net.minecraft.client.renderer.GlStateManager
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PetCandyUsedDisplay {
@@ -20,26 +20,9 @@ class PetCandyUsedDisplay {
if (petCandyUsed == 0) return
val stackTip = "§c$petCandyUsed"
-
- GlStateManager.disableLighting()
- GlStateManager.disableDepth()
- GlStateManager.disableBlend()
-
- val fontRenderer = event.fontRenderer
- val x = event.x + 13 - fontRenderer.getStringWidth(stackTip)
+ val x = event.x + 13
val y = event.y + 1
- val scale = 0.9
- GlStateManager.pushMatrix()
- GlStateManager.translate(x.toFloat(), y.toFloat(), 0f)
- GlStateManager.scale(scale, scale, scale)
- fontRenderer.drawStringWithShadow(stackTip, 0f, 0f, 16777215)
- val reverseScale = 1 / 0.7
- GlStateManager.scale(reverseScale, reverseScale, reverseScale)
- GlStateManager.popMatrix()
-
- GlStateManager.enableLighting()
- GlStateManager.enableDepth()
+ RenderUtils.drawSlotText(x, y, stackTip, .9f)
}
-
-}
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
index 0ed156362..a1c780199 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
@@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.events.GuiRenderItemEvent
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAppliedPocketSackInASack
-import net.minecraft.client.renderer.GlStateManager
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PocketSackInASackDisplay {
@@ -22,26 +22,10 @@ class PocketSackInASackDisplay {
val pocketSackInASackApplied = stack.getAppliedPocketSackInASack() ?: return
val stackTip = "§a$pocketSackInASackApplied"
-
- GlStateManager.disableLighting()
- GlStateManager.disableDepth()
- GlStateManager.disableBlend()
-
- val fontRenderer = event.fontRenderer
- val x = event.x + 13 - fontRenderer.getStringWidth(stackTip)
+ val x = event.x + 13
val y = event.y + 1
- val scale = 0.9
- GlStateManager.pushMatrix()
- GlStateManager.translate(x.toFloat(), y.toFloat(), 0f)
- GlStateManager.scale(scale, scale, scale)
- fontRenderer.drawStringWithShadow(stackTip, 0f, 0f, 16777215)
- val reverseScale = 1 / 0.7
- GlStateManager.scale(reverseScale, reverseScale, reverseScale)
- GlStateManager.popMatrix()
-
- GlStateManager.enableLighting()
- GlStateManager.enableDepth()
+ RenderUtils.drawSlotText(x, y, stackTip, .9f)
}
@SubscribeEvent