⚙ SHOCKY — 10:04
skull emoji
This commit is contained in:
parent
6f7dc8b944
commit
4b222f70b4
@ -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.MNames
|
||||||
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
|
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.math.cos
|
||||||
|
import kotlin.math.sin
|
||||||
|
|
||||||
class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
||||||
val idleState = AnimationState()
|
val idleState = AnimationState()
|
||||||
@ -322,16 +324,11 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
|||||||
class StayNearGoal(private val mob: Enforcer) : Goal() {
|
class StayNearGoal(private val mob: Enforcer) : Goal() {
|
||||||
private var target: LivingEntity? = null
|
private var target: LivingEntity? = null
|
||||||
private var moveCD = 0
|
private var moveCD = 0
|
||||||
private var movePos: Vec3? = null
|
|
||||||
|
|
||||||
override fun canUse(): Boolean {
|
override fun canUse(): Boolean {
|
||||||
return mob.target != null && !mob.isCharging
|
return mob.target != null && !mob.isCharging
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun canContinueToUse(): Boolean {
|
|
||||||
return canUse()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun start() {
|
override fun start() {
|
||||||
target = mob.target
|
target = mob.target
|
||||||
moveCD = 0
|
moveCD = 0
|
||||||
@ -345,12 +342,10 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
|||||||
|
|
||||||
target = mob.target ?: return
|
target = mob.target ?: return
|
||||||
|
|
||||||
if (moveCD > 0) {
|
if (--moveCD > 0)
|
||||||
moveCD--
|
|
||||||
return
|
return
|
||||||
}
|
|
||||||
|
|
||||||
moveCD = 10 + mob.random.nextInt(10)
|
moveCD = mob.random.nextInt(10, 20)
|
||||||
|
|
||||||
val targetX = target.x
|
val targetX = target.x
|
||||||
val targetZ = target.z
|
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 angle = mob.random.nextDouble() * Math.PI * 2
|
||||||
val distance = 8.0 + mob.random.nextDouble() * 3.0
|
val distance = 8.0 + mob.random.nextDouble() * 3.0
|
||||||
|
|
||||||
val offsetX = Math.cos(angle) * distance
|
val offsetX = cos(angle) * distance
|
||||||
val offsetZ = Math.sin(angle) * distance
|
val offsetZ = sin(angle) * distance
|
||||||
|
|
||||||
movePos = Vec3(targetX + offsetX, target.y + 2.0, targetZ + offsetZ)
|
mob.navigation.moveTo(targetX + offsetX, target.y + 2.0, targetZ + offsetZ, 1.5)
|
||||||
|
|
||||||
mob.navigation.moveTo(movePos!!.x, movePos!!.y, movePos!!.z, 1.5)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user