diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-23 23:45:24 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-23 23:45:24 +0200 |
| commit | f43bac23acf79325f9f4de060b69c5c0b1d870eb (patch) | |
| tree | f05971f36500a18091762a4b29f0b0415c25558f | |
| parent | a21c3298d2ae7790b3d3770ee4a135c1817f3018 (diff) | |
| download | SkyHanni-f43bac23acf79325f9f4de060b69c5c0b1d870eb.tar.gz SkyHanni-f43bac23acf79325f9f4de060b69c5c0b1d870eb.tar.bz2 SkyHanni-f43bac23acf79325f9f4de060b69c5c0b1d870eb.zip | |
Using EntityUtils.getEntities everywhere
29 files changed, 118 insertions, 167 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index c57119818..e64f09403 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP @@ -26,11 +27,8 @@ class EntityData { fun onTick(event: TickEvent.ClientTickEvent) { if (event.phase != TickEvent.Phase.START) return - val minecraft = Minecraft.getMinecraft() ?: return - val theWorld = minecraft.theWorld ?: return - for (entity in theWorld.loadedEntityList) { - if (entity !is EntityLivingBase) continue - + val entities = EntityUtils.getEntitiesOrNull<EntityLivingBase>() ?: return + for (entity in entities) { val maxHealth = entity.baseMaxHealth val oldMaxHealth = maxHealthMap.getOrDefault(entity, -1) if (oldMaxHealth != maxHealth) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt index 2bfb0c9cf..33e6fdd25 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -3,12 +3,12 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -57,8 +57,7 @@ class PlayerDeathMessages { private fun checkOtherPlayers() { val location = LocationUtils.playerLocation() - for (otherPlayer in Minecraft.getMinecraft().theWorld.loadedEntityList - .filterIsInstance<EntityOtherPlayerMP>() + for (otherPlayer in EntityUtils.getAllEntities<EntityOtherPlayerMP>() .filter { it.getLorenzVec().distance(location) < 25 }) { lastTimePlayerSeen[otherPlayer.name] = System.currentTimeMillis() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index 0e8d653b6..227790c3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -300,10 +300,8 @@ class DamageIndicatorManager { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (!LorenzUtils.inSkyBlock) return - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityLivingBase) { - checkEntity(entity) - } + for (entity in EntityUtils.getAllEntities<EntityLivingBase>()) { + checkEntity(entity) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt index 1cf80af5d..ad03f6c27 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -6,17 +6,13 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonData import at.hannibal2.skyhanni.features.dungeon.DungeonLividFinder import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.EntityUtils.hasBossHealth import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer -import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth -import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.StringUtils.matchRegex -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.Entity import net.minecraft.entity.EntityLiving @@ -583,17 +579,15 @@ class MobFinder { private fun findGuardians() { guardians.clear() - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityGuardian) { - //F3 - if (entity.hasMaxHealth(1_000_000) || entity.hasMaxHealth(1_200_000)) { - guardians.add(entity) - } + for (entity in EntityUtils.getAllEntities<EntityGuardian>()) { + //F3 + if (entity.hasMaxHealth(1_000_000) || entity.hasMaxHealth(1_200_000)) { + guardians.add(entity) + } - //M3 - if (entity.hasMaxHealth(120_000_000) || entity.hasMaxHealth(240_000_000)) { - guardians.add(entity) - } + //M3 + if (entity.hasMaxHealth(120_000_000) || entity.hasMaxHealth(240_000_000)) { + guardians.add(entity) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt index 369d6e762..241d3d5b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzColor.Companion.toLorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec @@ -36,8 +37,7 @@ object DungeonLividFinder { val dyeColor = blockLocation.getBlockStateAt().getValue(BlockStainedGlass.COLOR) val chatColor = dyeColor.toLorenzColor()?.getChatColor() ?: return - val world = Minecraft.getMinecraft().theWorld - val lividEntity = world.loadedEntityList.filterIsInstance<EntityArmorStand>() + val lividEntity = EntityUtils.getAllEntities<EntityArmorStand>() .firstOrNull { it.name.startsWith("${chatColor}﴾ ${chatColor}§lLivid") } ?: return val aabb = with(lividEntity) { @@ -50,6 +50,7 @@ object DungeonLividFinder { posZ + 0.5 ) } + val world = Minecraft.getMinecraft().theWorld livid = world.getEntitiesWithinAABB(EntityOtherPlayerMP::class.java, aabb) .takeIf { it.size == 1 }?.firstOrNull() ?: return livid?.let { diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt index 95bf9c30a..3e88766c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -60,8 +59,7 @@ class BarnFishingTimer { } } - private fun countMobs() = Minecraft.getMinecraft().theWorld.loadedEntityList - .filterIsInstance<EntityArmorStand>() + private fun countMobs() = EntityUtils.getAllEntities<EntityArmorStand>() .map { it.name } .count { it.endsWith("§c❤") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt index 1e72f0c4f..8f98d54ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt @@ -1,16 +1,12 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.common.cache.CacheBuilder -import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityItem import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -48,7 +44,7 @@ class ShowFishingItemName { fun onRenderWorld(event: RenderWorldLastEvent) { if (!isEnabled()) return if (hasRodInHand) { - for (entityItem in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityItem>()) { + for (entityItem in EntityUtils.getAllEntities<EntityItem>()) { val location = event.exactLocation(entityItem).add(0.0, 0.8, 0.0) if (location.distance(LocationUtils.playerLocation()) > 15) continue val itemStack = entityItem.entityItem diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 8d325bbf9..3bd53b846 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -600,20 +600,17 @@ class GardenVisitorFeatures { } private fun findEntity(nameTag: EntityArmorStand, visitor: Visitor) { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityArmorStand) continue + for (entity in EntityUtils.getAllEntities<EntityArmorStand>()) { if (entity.getLorenzVec().distanceIgnoreY(nameTag.getLorenzVec()) != 0.0) continue - visitor.entityId = entity?.entityId ?: 0 + visitor.entityId = entity.entityId visitor.nameTagEntityId = nameTag.entityId } } private fun findNametag(visitorName: String): EntityArmorStand? { val foundVisitorNameTags = mutableListOf<EntityArmorStand>() - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity !is EntityArmorStand) continue - + for (entity in EntityUtils.getAllEntities<EntityArmorStand>()) { if (entity.name.removeColor() == visitorName) { foundVisitorNameTags.add(entity) } @@ -624,8 +621,7 @@ class GardenVisitorFeatures { if (foundVisitorNameTags.size != 2) return null for (tag in foundVisitorNameTags.toMutableList()) { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity !is EntityArmorStand) continue + for (entity in EntityUtils.getAllEntities<EntityArmorStand>()) { if (entity in foundVisitorNameTags) continue val distance = entity.getLorenzVec().distance(tag.getLorenzVec()) if (distance < 1.5 && entity.name == "§bSam") { diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt index 42c796c5a..45614b3dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt @@ -7,10 +7,10 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.monster.EntityEndermite import net.minecraft.entity.monster.EntityIronGolem @@ -48,7 +48,7 @@ class HighlightMiningCommissionMobs { if (!isEnabled()) return if (!event.isMod(40)) return - val entities = Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityLivingBase>() + val entities = EntityUtils.getAllEntities<EntityLivingBase>() for ((type, entity) in active.flatMap { type -> entities.map { type to it } }) { if (type.isMob(entity)) { RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.YELLOW.toColor().withAlpha(127)) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt index 3e7547660..688649905 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.client.Minecraft @@ -46,14 +47,12 @@ class MarkedPlayerManager { } private fun findPlayers() { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityOtherPlayerMP) { - if (entity in markedPlayers.values) continue - - val name = entity.name.lowercase() - if (name in playerNamesToMark) { - markedPlayers[name] = entity - } + for (entity in EntityUtils.getAllEntities<EntityOtherPlayerMP>()) { + if (entity in markedPlayers.values) continue + + val name = entity.name.lowercase() + if (name in playerNamesToMark) { + markedPlayers[name] = entity } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index ca12ceea3..b91865aa3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt @@ -3,9 +3,9 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.dungeon.DungeonData +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft import net.minecraft.entity.projectile.EntitySmallFireball import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -36,8 +36,7 @@ class ParticleHider { if (SkyHanniMod.feature.misc.hideFireballParticles) { if (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE) { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList.toMutableList()) { - if (entity !is EntitySmallFireball) continue + for (entity in EntityUtils.getAllEntities<EntitySmallFireball>()) { val distance = entity.getLorenzVec().distance(event.location) if (distance < 5) { event.isCanceled = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt index 11d0e350d..81a20c679 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt @@ -2,15 +2,11 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture -import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawString -import at.hannibal2.skyhanni.utils.SpecialColour -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand import net.minecraft.init.Blocks import net.minecraftforge.client.event.RenderWorldLastEvent @@ -29,9 +25,10 @@ class ThunderSparksHighlight { fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return - Minecraft.getMinecraft().theWorld.loadedEntityList.filter { - it is EntityArmorStand && it !in sparks && it.hasSkullTexture(texture) - }.forEach { sparks.add(it as EntityArmorStand) } + + EntityUtils.getAllEntities<EntityArmorStand>().filter { + it !in sparks && it.hasSkullTexture(texture) + }.forEach { sparks.add(it) } } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index 1588d2c22..d0363480b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.trevor import at.hannibal2.skyhanni.data.TitleUtils +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth @@ -44,8 +45,8 @@ object TrevorSolver { fun findMob() { var canSee = false - val world = Minecraft.getMinecraft().theWorld ?: return - for (entity in world.getLoadedEntityList()) { + val entities = EntityUtils.getAllEntitiesOrNull() ?: return + for (entity in entities) { if (entity is EntityOtherPlayerMP) continue val name = entity.name val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth else 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt index 4e9382d8f..074fc191b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt @@ -7,10 +7,10 @@ import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsWith import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityBlaze @@ -37,7 +37,7 @@ class AshfangBlazes { } if (nearAshfang) { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityBlaze>() + for (entity in EntityUtils.getAllEntities<EntityBlaze>() .filter { it !in blazeColor.keys }) { val list = entity.getAllNameTagsWith(2, "Ashfang") if (list.size == 1) { @@ -70,8 +70,7 @@ class AshfangBlazes { } private fun checkNearAshfang() { - nearAshfang = Minecraft.getMinecraft().theWorld.loadedEntityList - .any { it is EntityArmorStand && it.name.contains("Ashfang") } + nearAshfang = EntityUtils.getAllEntities<EntityArmorStand>().any { it.name.contains("Ashfang") } } @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 5649cc481..b9ecf3200 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,13 +4,9 @@ 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.* 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 -import at.hannibal2.skyhanni.utils.SpecialColour -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.world.WorldEvent @@ -28,9 +24,9 @@ class AshfangBlazingSouls { fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return - Minecraft.getMinecraft().theWorld.loadedEntityList.filter { - it is EntityArmorStand && it !in souls && it.hasSkullTexture(texture) - }.forEach { souls.add(it as EntityArmorStand) } + EntityUtils.getAllEntities<EntityArmorStand>() + .filter { it !in souls && it.hasSkullTexture(texture) + }.forEach { souls.add(it) } } @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 be68a1583..da9d134e6 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 @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.utils.* 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 import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.world.WorldEvent @@ -24,10 +23,9 @@ class AshfangGravityOrbs { fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return - Minecraft.getMinecraft().theWorld.loadedEntityList - .filter { - it is EntityArmorStand && it !in orbs && it.hasSkullTexture(texture) - }.forEach { orbs.add(it as EntityArmorStand) } + EntityUtils.getAllEntities<EntityArmorStand>() + .filter { it !in orbs && it.hasSkullTexture(textu |
