⚙ SHOCKY — 10:04

skull emoji
This commit is contained in:
DBotThePony 2025-03-23 10:08:37 +07:00
parent 6f7dc8b944
commit 4b222f70b4
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -39,6 +39,8 @@ import ru.dbotthepony.mc.otm.core.util.TickList
import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
import java.util.*
import kotlin.math.cos
import kotlin.math.sin
class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
val idleState = AnimationState()
@ -322,16 +324,11 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
class StayNearGoal(private val mob: Enforcer) : Goal() {
private var target: LivingEntity? = null
private var moveCD = 0
private var movePos: Vec3? = null
override fun canUse(): Boolean {
return mob.target != null && !mob.isCharging
}
override fun canContinueToUse(): Boolean {
return canUse()
}
override fun start() {
target = mob.target
moveCD = 0
@ -345,12 +342,10 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
target = mob.target ?: return
if (moveCD > 0) {
moveCD--
if (--moveCD > 0)
return
}
moveCD = 10 + mob.random.nextInt(10)
moveCD = mob.random.nextInt(10, 20)
val targetX = target.x
val targetZ = target.z
@ -358,12 +353,10 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
val angle = mob.random.nextDouble() * Math.PI * 2
val distance = 8.0 + mob.random.nextDouble() * 3.0
val offsetX = Math.cos(angle) * distance
val offsetZ = Math.sin(angle) * distance
val offsetX = cos(angle) * distance
val offsetZ = sin(angle) * distance
movePos = Vec3(targetX + offsetX, target.y + 2.0, targetZ + offsetZ)
mob.navigation.moveTo(movePos!!.x, movePos!!.y, movePos!!.z, 1.5)
mob.navigation.moveTo(targetX + offsetX, target.y + 2.0, targetZ + offsetZ, 1.5)
}
}