summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-07-24 13:59:47 +0200
committerGitHub <noreply@github.com>2023-07-24 13:59:47 +0200
commit105fc8082a59f3bade7a7cf560a9d27c521b4f30 (patch)
treed98048a11f72bdf6015150f8614de38698d957b3 /src/main/java/at/hannibal2/skyhanni/utils
parent2c61e4e7ee05a5ebb7d3012d1aae6a6e3aa4d04e (diff)
downloadskyhanni-105fc8082a59f3bade7a7cf560a9d27c521b4f30.tar.gz
skyhanni-105fc8082a59f3bade7a7cf560a9d27c521b4f30.tar.bz2
skyhanni-105fc8082a59f3bade7a7cf560a9d27c521b4f30.zip
Merge pull request #309
* added text on Killer spring and Blood ichor * twinclaw sound and delay * Merge branch 'beta' of https://github.com/hannibal002/skyhanni into i… * draw line from boss to ichor/spring * changed default color * fixes * fixes * draw line to the boss head if higlighted * Merge branch 'beta' into ichor_spring_text * merge conflicts and more sub configs
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
index 30a8025cf..9bfb9e1bb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -5,11 +5,9 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import net.minecraft.block.state.IBlockState
import net.minecraft.client.Minecraft
-import net.minecraft.client.multiplayer.WorldClient
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
-import net.minecraft.entity.monster.EntityBlaze
import net.minecraft.entity.monster.EntityEnderman
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
@@ -129,20 +127,20 @@ object EntityUtils {
}
inline fun <reified T : Entity> getEntitiesNextToPlayer(radius: Double): List<T> =
- getEntitiesNearby(LocationUtils.playerLocation(), radius)
+ getEntitiesNearby<T>(LocationUtils.playerLocation(), radius)
inline fun <reified T : Entity> getEntitiesNearby(location: LorenzVec, radius: Double): List<T> =
- getAllEntities().filterIsInstance<T>().filter { it.distanceTo(location) < radius }
+ getEntities<T>().filter { it.distanceTo(location) < radius }
fun EntityLivingBase.isAtFullHealth() = baseMaxHealth == health.toInt()
- fun WorldClient.getEntitiesNearby(
- clazz: Class<EntityBlaze>,
- location: LorenzVec,
- radius: Double
- ): MutableList<EntityBlaze> = getEntities(clazz) { entity ->
- entity?.getLorenzVec()?.let { it.distance(location) < radius } ?: false
- }
+// fun WorldClient.getEntitiesNearby(
+// clazz: Class<EntityBlaze>,
+// location: LorenzVec,
+// radius: Double
+// ): MutableList<EntityBlaze> = getEntities(clazz) { entity ->
+// entity?.getLorenzVec()?.let { it.distance(location) < radius } ?: false
+// }
fun EntityArmorStand.hasSkullTexture(skin: String): Boolean {
if (inventory == null) return false
@@ -158,9 +156,9 @@ object EntityUtils {
fun EntityEnderman.getBlockInHand(): IBlockState? = heldBlockState
- inline fun <reified R: Entity> getEntities(): List<R> = getAllEntities().filterIsInstance<R>()
+ inline fun <reified R : Entity> getEntities(): List<R> = getAllEntities().filterIsInstance<R>()
- inline fun <reified R: Entity> getEntitiesOrNull(): List<R>? = getAllEntitiesOrNull()?.filterIsInstance<R>()
+ inline fun <reified R : Entity> getEntitiesOrNull(): List<R>? = getAllEntitiesOrNull()?.filterIsInstance<R>()
fun getAllEntities(): List<Entity> = getAllEntitiesOrNull() ?: error("minecraft.world.loadedEntityList is null.")