From a14c06c06aef1668a7f132b232a0edc565ee687f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 1 Oct 2022 19:16:44 +0200 Subject: used hasSkullTexture more often --- .../skyhanni/features/ThunderSparksHighlight.kt | 8 ++++---- .../features/nether/ashfang/AshfangBlazingSouls.kt | 13 ++++++------- .../features/nether/ashfang/AshfangGravityOrbs.kt | 7 +++---- .../features/slayer/blaze/BlazeSlayerPillar.kt | 5 +++-- .../features/summonings/SummoningSoulsName.kt | 19 ++----------------- 5 files changed, 18 insertions(+), 34 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt index b714f2c5a..20fd10f6a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawString @@ -28,9 +28,9 @@ class ThunderSparksHighlight { fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return - Minecraft.getMinecraft().theWorld.loadedEntityList.filter { it -> - it is EntityArmorStand && it !in sparks && it.inventory.any { it != null && it.getSkullTexture() == texture } - }.forEach { sparks.add(it as EntityArmorStand) } + Minecraft.getMinecraft().theWorld.loadedEntityList.filter { + it is EntityArmorStand && it !in sparks && it.hasSkullTexture(texture) + }.forEach { sparks.add(it as EntityArmorStand) } } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt index c31733715..9dba408bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawString @@ -20,18 +20,17 @@ import java.awt.Color class AshfangBlazingSouls { - private val texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODI4N2IzOTdkYWY5NTE2YTBiZDc2ZjVmMWI3YmY5Nzk1MTVkZjNkNWQ4MzNlMDYzNWZhNjhiMzdlZTA4MjIxMiJ9fX0=" + private val texture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODI4N2IzOTdkYWY5NTE2YTBiZDc2ZjVmMWI3YmY5Nzk1MTVkZjNkNWQ4MzNlMDYzNWZhNjhiMzdlZTA4MjIxMiJ9fX0=" private val souls = mutableListOf() @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return - Minecraft.getMinecraft().theWorld.loadedEntityList - .filter { it -> - it is EntityArmorStand && it !in souls && it.inventory - .any { it != null && it.getSkullTexture() == texture } - }.forEach { souls.add(it as EntityArmorStand) } + Minecraft.getMinecraft().theWorld.loadedEntityList.filter { + it is EntityArmorStand && it !in souls && it.hasSkullTexture(texture) + }.forEach { souls.add(it as EntityArmorStand) } } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt index c0dbe3108..4f54bbd5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.utils.* -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.RenderUtils.drawString import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand @@ -25,9 +25,8 @@ class AshfangGravityOrbs { if (!isEnabled()) return Minecraft.getMinecraft().theWorld.loadedEntityList - .filter { it -> - it is EntityArmorStand && it !in orbs && it.inventory - .any { it != null && it.getSkullTexture() == texture } + .filter { + it is EntityArmorStand && it !in orbs && it.hasSkullTexture(texture) }.forEach { orbs.add(it as EntityArmorStand) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt index 014cd11c2..0904d809c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex @@ -27,6 +27,7 @@ class BlazeSlayerPillar { private var patternPillarExploded = Pattern.compile("§cYou took §r§f(.+) §r§ctrue damage from an exploding fire pillar!") private val pillarEntities = mutableListOf() + companion object { const val pillarWarningTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWMyZTlkODM5NWNhY2Q5OTIyODY5YzE1MzczY2Y3Y2IxNmRhMGE1Y2U1ZjNjNjMyYjE5Y2ViMzkyOWM5YTExIn19fQ==" @@ -56,7 +57,7 @@ class BlazeSlayerPillar { } } - if (armorStand in pillarBuildEntityList || armorStand.inventory.any { it != null && it.getSkullTexture() == pillarWarningTexture }) { + if (armorStand in pillarBuildEntityList || armorStand.hasSkullTexture(pillarWarningTexture)) { if (armorStand !in pillarBuildEntityList) { pillarBuildEntityList.add(armorStand) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt index c0ea8540b..7c6c889b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.summonings import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.test.GriffinJavaUtils import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawString @@ -48,7 +48,7 @@ class SummoningSoulsName { if (souls.contains(entity)) continue if (entity is EntityArmorStand) { - if (isSoul(entity)) { + if (entity.hasSkullTexture(texture)) { val soulLocation = entity.getLorenzVec() val map = mutableMapOf() @@ -111,21 +111,6 @@ class SummoningSoulsName { mobsName.clear() } - private fun isSoul(entity: EntityArmorStand): Boolean { - for (stack in entity.inventory) { - if (stack != null) { - val skullTexture = stack.getSkullTexture() - if (skullTexture != null) { - if (skullTexture == texture) { - return true - } - } - } - } - - return false - } - private fun isEnabled(): Boolean { return LorenzUtils.inSkyblock && SkyHanniMod.feature.summonings.summoningSoulDisplay } -- cgit