aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-22 21:09:52 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-22 21:09:52 +0200
commitcc5e3b78f881e034f2bd4806ff4264fd2514be1d (patch)
tree94194baf4a0616b985d8b459753e36900fee8df9 /src/main/java/at/hannibal2/skyhanni/features
parent97fb725628fc39bc94fcaa14c55880e6a9fbdd04 (diff)
downloadskyhanni-cc5e3b78f881e034f2bd4806ff4264fd2514be1d.tar.gz
skyhanni-cc5e3b78f881e034f2bd4806ff4264fd2514be1d.tar.bz2
skyhanni-cc5e3b78f881e034f2bd4806ff4264fd2514be1d.zip
Added Odonatas Highlighter
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt51
2 files changed, 55 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt
index efaed60d6..93df913c8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt
@@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class RiftLarva {
private val config get() = SkyHanniMod.feature.rift.larvas
- private var hasLarvaHookInHand = false
+ private var hasHookInHand = false
val larvaSkullTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTgzYjMwZTlkMTM1YjA1MTkwZWVhMmMzYWM2MWUyYWI1NWEyZDgxZTFhNThkYmIyNjk4M2ExNDA4MjY2NCJ9fX0="
@@ -23,7 +23,7 @@ class RiftLarva {
if (!isEnabled()) return
checkHand()
- if (!hasLarvaHookInHand) return
+ if (!hasHookInHand) return
if (event.isMod(20)) {
findLarvas()
@@ -31,7 +31,7 @@ class RiftLarva {
}
private fun checkHand() {
- hasLarvaHookInHand = InventoryUtils.getItemInHand()?.getInternalName() == "LARVA_HOOK"
+ hasHookInHand = InventoryUtils.getItemInHand()?.getInternalName() == "LARVA_HOOK"
}
private fun findLarvas() {
@@ -42,7 +42,7 @@ class RiftLarva {
RenderLivingEntityHelper.setEntityColor(
stand,
config.highlightColor.toChromaColor().withAlpha(1)
- ) { isEnabled() && hasLarvaHookInHand }
+ ) { isEnabled() && hasHookInHand }
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt
new file mode 100644
index 000000000..7c3fae78b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt
@@ -0,0 +1,51 @@
+package at.hannibal2.skyhanni.features.rift
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.events.withAlpha
+import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
+import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
+import net.minecraft.client.Minecraft
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class RiftOdonata {
+ private val config get() = SkyHanniMod.feature.rift.odonata
+ private var hasBottleInHand = false
+ val odonataSkullTexture =
+ "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkODA2ZGVmZGZkZjU5YjFmMjYwOWM4ZWUzNjQ2NjZkZTY2MTI3YTYyMzQxNWI1NDMwYzkzNThjNjAxZWY3YyJ9fX0="
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled()) return
+
+ checkHand()
+ if (!hasBottleInHand) return
+
+ if (event.isMod(20)) {
+ findOdonatas()
+ }
+ }
+
+ private fun checkHand() {
+ hasBottleInHand = InventoryUtils.getItemInHand()?.getInternalName() == "EMPTY_ODONATA_BOTTLE"
+ }
+
+ private fun findOdonatas() {
+
+ val list = Minecraft.getMinecraft().theWorld?.loadedEntityList ?: return
+ for (stand in list.filterIsInstance<EntityArmorStand>()) {
+ if (stand.hasSkullTexture(odonataSkullTexture)) {
+ RenderLivingEntityHelper.setEntityColor(
+ stand,
+ config.highlightColor.toChromaColor().withAlpha(1)
+ ) { isEnabled() && hasBottleInHand }
+ }
+ }
+ }
+
+ fun isEnabled() = RiftAPI.inRift() && config.highlight
+}