aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-04-22 14:15:40 +0200
committerGitHub <noreply@github.com>2024-04-22 14:15:40 +0200
commit74b18c1f246855d2a70ece6e96b381345f721a85 (patch)
tree3e6bccc7a83d216d55fd3ebc560c2af3eac9663f /src/main
parent88d93f33a51fd1914907111a9818b7a902260e21 (diff)
downloadskyhanni-74b18c1f246855d2a70ece6e96b381345f721a85.tar.gz
skyhanni-74b18c1f246855d2a70ece6e96b381345f721a85.tar.bz2
skyhanni-74b18c1f246855d2a70ece6e96b381345f721a85.zip
Fix: Wierd default Armorstand value (#1495)
Diffstat (limited to 'src/main')
-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