diff options
Diffstat (limited to 'src')
3 files changed, 8 insertions, 9 deletions
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 9998edca6..83a2abbec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -300,7 +300,7 @@ class DamageIndicatorManager { fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return data = data.editCopy { - EntityUtils.getEntitiesSequence<EntityLivingBase>().mapNotNull(::checkEntity).forEach { this put it } + EntityUtils.getEntities<EntityLivingBase>().mapNotNull(::checkEntity).forEach { this put it } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt index d6ae27f3b..d2abd8bf1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class EndermanSlayerHideParticles { - private var endermanLocations = listOf<LorenzVec>() + private var endermanLocations = sequenceOf<LorenzVec>() @SubscribeEvent fun onTick(event: LorenzTickEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 24f838cfc..42a5b5583 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -126,10 +126,10 @@ object EntityUtils { ?.value } - inline fun <reified T : Entity> getEntitiesNextToPlayer(radius: Double): List<T> = + inline fun <reified T : Entity> getEntitiesNextToPlayer(radius: Double): Sequence<T> = getEntitiesNearby<T>(LocationUtils.playerLocation(), radius) - inline fun <reified T : Entity> getEntitiesNearby(location: LorenzVec, radius: Double): List<T> = + inline fun <reified T : Entity> getEntitiesNearby(location: LorenzVec, radius: Double): Sequence<T> = getEntities<T>().filter { it.distanceTo(location) < radius } fun EntityLivingBase.isAtFullHealth() = baseMaxHealth == health.toInt() @@ -156,12 +156,11 @@ object EntityUtils { fun EntityEnderman.getBlockInHand(): IBlockState? = heldBlockState - inline fun <reified R : Entity> getEntities(): List<R> = getAllEntities().filterIsInstance<R>() - inline fun <reified R : Entity> getEntitiesSequence(): Sequence<R> = Minecraft.getMinecraft()?.theWorld?.loadedEntityList?.asSequence()?.filterIsInstance<R>() ?: emptySequence() + inline fun <reified R : Entity> getEntities(): Sequence<R> = getAllEntities().filterIsInstance<R>() - inline fun <reified R : Entity> getEntitiesOrNull(): List<R>? = getAllEntitiesOrNull()?.filterIsInstance<R>() + inline fun <reified R : Entity> getEntitiesOrNull(): Sequence<R>? = getAllEntitiesOrNull()?.filterIsInstance<R>() - fun getAllEntities(): List<Entity> = getAllEntitiesOrNull() ?: error("minecraft.world.loadedEntityList is null.") + fun getAllEntities(): Sequence<Entity> = getAllEntitiesOrNull() ?: emptySequence() - fun getAllEntitiesOrNull(): List<Entity>? = Minecraft.getMinecraft()?.theWorld?.loadedEntityList?.toMutableList() + fun getAllEntitiesOrNull(): Sequence<Entity>? = Minecraft.getMinecraft()?.theWorld?.loadedEntityList?.asSequence() }
\ No newline at end of file |
