aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-01 17:00:01 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-01 17:00:01 +0200
commitce00374e43f54ab574a8198f94d7a13270d48888 (patch)
treea6fa18deea59bb66cec166c2a5f412c0ca29beb2 /src/main/java/at/hannibal2/skyhanni/utils
parent9946e80fa0fb5da41c4ad8e5ace2edad6c519167 (diff)
downloadskyhanni-ce00374e43f54ab574a8198f94d7a13270d48888.tar.gz
skyhanni-ce00374e43f54ab574a8198f94d7a13270d48888.tar.bz2
skyhanni-ce00374e43f54ab574a8198f94d7a13270d48888.zip
add blaze particle hide feature
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt15
2 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
index 47575c3f5..ad96a9510 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -1,9 +1,11 @@
package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
+import net.minecraft.client.multiplayer.WorldClient
import net.minecraft.entity.EntityLiving
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.entity.monster.EntityBlaze
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.util.AxisAlignedBB
@@ -101,4 +103,12 @@ object EntityUtils {
.firstOrNull { it.name == "textures" }
?.value
}
+
+ fun WorldClient.getEntitiesNearby(
+ clazz: Class<EntityBlaze>,
+ location: LorenzVec,
+ radius: Double
+ ): MutableList<EntityBlaze> = getEntities(clazz) { entity ->
+ entity?.getLorenzVec()?.let { it.distance(location) < radius } ?: false
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 90b60a7c3..c4c9cedca 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -113,4 +113,19 @@ object LorenzUtils {
fun consoleLog(text: String) {
SkyHanniMod.consoleLog(text)
}
+
+ // Taken and modified from https://stackoverflow.com/a/11306854/5507634
+ fun getCallerClass(vararg skip: String): String? {
+ val stElements = Thread.currentThread().stackTrace
+ for (i in 1 until stElements.size) {
+ val ste = stElements[i]
+ val className = ste.className
+ if (className != LorenzUtils::class.java.name && className.indexOf("java.lang.Thread") != 0) {
+ if (className !in skip) {
+ return className
+ }
+ }
+ }
+ return null
+ }
} \ No newline at end of file