aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
index 5629eefcf..80eee1f2d 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
@@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.refreshReference
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.MobUtils
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.entity.EntityPlayerSP
import net.minecraft.entity.EntityLivingBase
@@ -68,6 +69,7 @@ class MobDetection {
MobFilter.wokeSleepingGolemPattern
MobFilter.jerryPattern
MobFilter.jerryMagmaCubePattern
+ MobUtils.defaultArmorStandName
}
private fun mobDetectionReset() {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt
index 1c632bcee..6aff6406d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt
@@ -5,13 +5,15 @@ import at.hannibal2.skyhanni.data.mob.MobData
import at.hannibal2.skyhanni.utils.EntityUtils.cleanName
import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo
import at.hannibal2.skyhanni.utils.LocationUtils.rayIntersects
+import at.hannibal2.skyhanni.utils.StringUtils.matches
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.player.EntityPlayer
object MobUtils {
- private const val defaultArmorStandName = "Armor Stand"
+ val defaultArmorStandName by RepoPattern.pattern("armorstand.default", "Armou?r Stand")
// The corresponding ArmorStand for a mob has always the ID + 1 (with some exceptions)
fun getArmorStand(entity: Entity, offset: Int = 1) = getNextEntity(entity, offset) as? EntityArmorStand
@@ -28,7 +30,7 @@ object MobUtils {
getArmorStandByRangeAll(entity, range).filter { it.cleanName().startsWith(name) }
.sortedBy { it.distanceTo(entity) }.firstOrNull()
- fun EntityArmorStand.isDefaultValue() = this.name == defaultArmorStandName
+ fun EntityArmorStand.isDefaultValue() = defaultArmorStandName.matches(this.name)
fun EntityArmorStand?.takeNonDefault() = this?.takeIf { !it.isDefaultValue() }
@@ -54,7 +56,7 @@ object MobUtils {
entity: Entity,
distance: Double,
partialTicks: Float,
- offset: LorenzVec = LorenzVec()
+ offset: LorenzVec = LorenzVec(),
) =
rayTraceForMobs(entity, partialTicks, offset)?.filter {
it.baseEntity.distanceTo(entity.getLorenzVec()) <= distance