More fixes for RammingGoal
This commit is contained in:
parent
7ed8c6673c
commit
f0da7102c9
@ -16,6 +16,7 @@ import net.minecraft.world.damagesource.DamageSource
|
|||||||
import net.minecraft.world.entity.AnimationState
|
import net.minecraft.world.entity.AnimationState
|
||||||
import net.minecraft.world.entity.EntityType
|
import net.minecraft.world.entity.EntityType
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.MoverType
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier
|
import net.minecraft.world.entity.ai.attributes.AttributeSupplier
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes
|
import net.minecraft.world.entity.ai.attributes.Attributes
|
||||||
import net.minecraft.world.entity.ai.goal.Goal
|
import net.minecraft.world.entity.ai.goal.Goal
|
||||||
@ -243,40 +244,39 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
|||||||
val leftPartic_z = mob.z - mob.lookAngle.z * 2 + 0.8f * mob.lookAngle.x
|
val leftPartic_z = mob.z - mob.lookAngle.z * 2 + 0.8f * mob.lookAngle.x
|
||||||
val rightPartic_z = mob.z - mob.lookAngle.z * 2 - 0.8f * mob.lookAngle.x
|
val rightPartic_z = mob.z - mob.lookAngle.z * 2 - 0.8f * mob.lookAngle.x
|
||||||
|
|
||||||
if (mob.level() is ServerLevel) {
|
val level = mob.level() as ServerLevel
|
||||||
(mob.level() as ServerLevel).sendParticles(
|
|
||||||
ParticleTypes.LARGE_SMOKE,
|
|
||||||
leftPartic_x, smoke_y, leftPartic_z,
|
|
||||||
2,
|
|
||||||
0.0, 0.07, 0.0,
|
|
||||||
0.01
|
|
||||||
)
|
|
||||||
|
|
||||||
(mob.level() as ServerLevel).sendParticles(
|
level.sendParticles(
|
||||||
ParticleTypes.LARGE_SMOKE,
|
ParticleTypes.LARGE_SMOKE,
|
||||||
rightPartic_x, smoke_y, rightPartic_z,
|
leftPartic_x, smoke_y, leftPartic_z,
|
||||||
2,
|
2,
|
||||||
0.0, 0.07, 0.0,
|
0.0, 0.07, 0.0,
|
||||||
0.01
|
0.01
|
||||||
)
|
)
|
||||||
|
|
||||||
|
level.sendParticles(
|
||||||
|
ParticleTypes.LARGE_SMOKE,
|
||||||
|
rightPartic_x, smoke_y, rightPartic_z,
|
||||||
|
2,
|
||||||
|
0.0, 0.07, 0.0,
|
||||||
|
0.01
|
||||||
|
)
|
||||||
|
|
||||||
|
if (chargeDir == null || chargeDir!!.length() < 0.1) {
|
||||||
|
stop()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chargeTime == windupTime) {
|
mob.playSound(MSoundEvents.ENFORCER_CHARGE, 1.0f, 1.0f)
|
||||||
if (chargeDir == null || chargeDir!!.length() < 0.1) {
|
|
||||||
stop()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
mob.playSound(MSoundEvents.ENFORCER_CHARGE, 1.0f, 1.0f)
|
|
||||||
}
|
|
||||||
|
|
||||||
val dir = chargeDir ?: return
|
val dir = chargeDir ?: return
|
||||||
mob.yRot = (-Mth.atan2(dir.x, dir.z) * (180f / Math.PI)).toFloat()
|
mob.yRot = Math.toDegrees(-Mth.atan2(dir.x, dir.z)).toFloat()
|
||||||
mob.yHeadRot = mob.yRot
|
mob.yHeadRot = mob.yRot
|
||||||
|
|
||||||
mob.move(net.minecraft.world.entity.MoverType.SELF, dir.scale(1.8))
|
mob.move(MoverType.SELF, dir.scale(1.8))
|
||||||
|
|
||||||
if (mob.horizontalCollision) {
|
if (mob.horizontalCollision) {
|
||||||
mob.level().playSound(
|
level.playSound(
|
||||||
null,
|
null,
|
||||||
mob.x, mob.y, mob.z,
|
mob.x, mob.y, mob.z,
|
||||||
SoundEvents.GENERIC_EXPLODE,
|
SoundEvents.GENERIC_EXPLODE,
|
||||||
@ -284,6 +284,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
|
|||||||
1.0f,
|
1.0f,
|
||||||
1.0f
|
1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
stop()
|
stop()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user