More fixes for RammingGoal

This commit is contained in:
DBotThePony 2025-03-23 09:56:39 +07:00
parent 7ed8c6673c
commit f0da7102c9
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -16,6 +16,7 @@ import net.minecraft.world.damagesource.DamageSource
import net.minecraft.world.entity.AnimationState
import net.minecraft.world.entity.EntityType
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.Attributes
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 rightPartic_z = mob.z - mob.lookAngle.z * 2 - 0.8f * mob.lookAngle.x
if (mob.level() is ServerLevel) {
(mob.level() as ServerLevel).sendParticles(
ParticleTypes.LARGE_SMOKE,
leftPartic_x, smoke_y, leftPartic_z,
2,
0.0, 0.07, 0.0,
0.01
)
val level = mob.level() as ServerLevel
(mob.level() as ServerLevel).sendParticles(
ParticleTypes.LARGE_SMOKE,
rightPartic_x, smoke_y, rightPartic_z,
2,
0.0, 0.07, 0.0,
0.01
)
level.sendParticles(
ParticleTypes.LARGE_SMOKE,
leftPartic_x, smoke_y, leftPartic_z,
2,
0.0, 0.07, 0.0,
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) {
if (chargeDir == null || chargeDir!!.length() < 0.1) {
stop()
return
}
mob.playSound(MSoundEvents.ENFORCER_CHARGE, 1.0f, 1.0f)
}
mob.playSound(MSoundEvents.ENFORCER_CHARGE, 1.0f, 1.0f)
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.move(net.minecraft.world.entity.MoverType.SELF, dir.scale(1.8))
mob.move(MoverType.SELF, dir.scale(1.8))
if (mob.horizontalCollision) {
mob.level().playSound(
level.playSound(
null,
mob.x, mob.y, mob.z,
SoundEvents.GENERIC_EXPLODE,
@ -284,6 +284,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
1.0f,
1.0f
)
stop()
return
}