aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt42
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt46
3 files changed, 48 insertions, 46 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt
index 0ca601a54..13900555e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt
@@ -1,14 +1,10 @@
package at.hannibal2.skyhanni.features
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.features.damageindicator.getNameTagWith
import at.hannibal2.skyhanni.test.GriffinJavaUtils
+import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
-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.getLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.entity.EntityLiving
import net.minecraft.entity.item.EntityArmorStand
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt
index 421394d7e..9a91c7680 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt
@@ -6,18 +6,16 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.getLorenzVec
+import at.hannibal2.skyhanni.utils.hasNameTagWith
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
-import net.minecraft.entity.EntityLiving
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.boss.EntityDragon
import net.minecraft.entity.boss.EntityWither
-import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.monster.*
import net.minecraft.entity.passive.EntityHorse
import net.minecraft.entity.passive.EntityWolf
-import net.minecraft.util.AxisAlignedBB
import java.util.*
class BossFinder {
@@ -536,42 +534,4 @@ class BossFinder {
return null
}
-}
-
-//TODO move into utils method
-fun EntityLiving.hasNameTagWith(
- y: Int,
- contains: String,
- debugRightEntity: Boolean = false,
- inaccuracy: Double = 1.6,
- debugWrongEntity: Boolean = false,
-): Boolean {
- return getNameTagWith(y, contains, debugRightEntity, inaccuracy, debugWrongEntity) != null
-}
-
-fun EntityLiving.getNameTagWith(
- y: Int,
- contains: String,
- debugRightEntity: Boolean = false,
- inaccuracy: Double = 1.6,
- debugWrongEntity: Boolean = false,
-): EntityArmorStand? {
- val center = getLorenzVec().add(0, y, 0)
- val a = center.add(-inaccuracy, -inaccuracy - 3, -inaccuracy).toBlocPos()
- val b = center.add(inaccuracy, inaccuracy + 3, inaccuracy).toBlocPos()
- val alignedBB = AxisAlignedBB(a, b)
- val clazz = EntityArmorStand::class.java
- val found = worldObj.getEntitiesWithinAABB(clazz, alignedBB)
- return found.find {
- val result = it.name.contains(contains)
- if (debugWrongEntity && !result) {
- println("wrong entity in aabb: '" + it.name + "'")
- }
- if (debugRightEntity && result) {
- println("mob: " + center.printWithAccuracy(2))
- println("nametag: " + it.getLorenzVec().printWithAccuracy(2))
- println("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3))
- }
- result
- }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
new file mode 100644
index 000000000..acfcd86d4
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -0,0 +1,46 @@
+package at.hannibal2.skyhanni.utils
+
+import net.minecraft.entity.EntityLiving
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.util.AxisAlignedBB
+
+class EntityUtils {
+}
+
+//TODO move into utils method
+fun EntityLiving.hasNameTagWith(
+ y: Int,
+ contains: String,
+ debugRightEntity: Boolean = false,
+ inaccuracy: Double = 1.6,
+ debugWrongEntity: Boolean = false,
+): Boolean {
+ return getNameTagWith(y, contains, debugRightEntity, inaccuracy, debugWrongEntity) != null
+}
+
+fun EntityLiving.getNameTagWith(
+ y: Int,
+ contains: String,
+ debugRightEntity: Boolean = false,
+ inaccuracy: Double = 1.6,
+ debugWrongEntity: Boolean = false,
+): EntityArmorStand? {
+ val center = getLorenzVec().add(0, y, 0)
+ val a = center.add(-inaccuracy, -inaccuracy - 3, -inaccuracy).toBlocPos()
+ val b = center.add(inaccuracy, inaccuracy + 3, inaccuracy).toBlocPos()
+ val alignedBB = AxisAlignedBB(a, b)
+ val clazz = EntityArmorStand::class.java
+ val found = worldObj.getEntitiesWithinAABB(clazz, alignedBB)
+ return found.find {
+ val result = it.name.contains(contains)
+ if (debugWrongEntity && !result) {
+ println("wrong entity in aabb: '" + it.name + "'")
+ }
+ if (debugRightEntity && result) {
+ println("mob: " + center.printWithAccuracy(2))
+ println("nametag: " + it.getLorenzVec().printWithAccuracy(2))
+ println("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3))
+ }
+ result
+ }
+} \ No newline at end of file