diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-22 19:14:04 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-22 19:14:04 +0200 |
commit | de3fe21430a47bab500d71bfbbd0e22ae69a4285 (patch) | |
tree | 470b5333ce3ef691150e138a06db2f84bc9c6144 /src/main/java/at/hannibal2/skyhanni/features/rift | |
parent | 84d060a961e892c713eed16dd898c9f7f10fdd40 (diff) | |
download | skyhanni-de3fe21430a47bab500d71bfbbd0e22ae69a4285.tar.gz skyhanni-de3fe21430a47bab500d71bfbbd0e22ae69a4285.tar.bz2 skyhanni-de3fe21430a47bab500d71bfbbd0e22ae69a4285.zip |
Added Larvas Highlight
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/rift')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt | 51 |
1 files changed, 51 insertions, 0 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 new file mode 100644 index 000000000..efaed60d6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.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 RiftLarva { + private val config get() = SkyHanniMod.feature.rift.larvas + private var hasLarvaHookInHand = false + val larvaSkullTexture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTgzYjMwZTlkMTM1YjA1MTkwZWVhMmMzYWM2MWUyYWI1NWEyZDgxZTFhNThkYmIyNjk4M2ExNDA4MjY2NCJ9fX0=" + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!isEnabled()) return + + checkHand() + if (!hasLarvaHookInHand) return + + if (event.isMod(20)) { + findLarvas() + } + } + + private fun checkHand() { + hasLarvaHookInHand = InventoryUtils.getItemInHand()?.getInternalName() == "LARVA_HOOK" + } + + private fun findLarvas() { + + val list = Minecraft.getMinecraft().theWorld?.loadedEntityList ?: return + for (stand in list.filterIsInstance<EntityArmorStand>()) { + if (stand.hasSkullTexture(larvaSkullTexture)) { + RenderLivingEntityHelper.setEntityColor( + stand, + config.highlightColor.toChromaColor().withAlpha(1) + ) { isEnabled() && hasLarvaHookInHand } + } + } + } + + fun isEnabled() = RiftAPI.inRift() && config.highlight +} |