diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt | 8 |
1 files changed, 5 insertions, 3 deletions
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 |