Update loader particle code

This commit is contained in:
DBotThePony 2025-03-23 10:18:44 +07:00
parent a5ba06b52f
commit 9848f64ee6
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -124,6 +124,22 @@ class Loader(type: EntityType<Loader>, level: Level) : Monster(type, level) {
ResourceLocation(OverdriveThatMatters.MOD_ID, "entities/loader"))
}
override fun customServerAiStep() {
super.customServerAiStep()
val level = level() as ServerLevel
if (health <= 30.0 && random.nextFloat() < 0.2f) {
level.sendParticles(
ParticleTypes.CAMPFIRE_COSY_SMOKE,
x, y+2, z,
1,
0.0, 0.0, 0.0,
0.01
)
}
}
override fun aiStep() {
super.aiStep()
@ -133,17 +149,8 @@ class Loader(type: EntityType<Loader>, level: Level) : Monster(type, level) {
isAttacking = false
}
}
if (level() is ServerLevel && this.health <= 30.0 && tickCount % 5 == 0){
(level() as ServerLevel).sendParticles(
ParticleTypes.CAMPFIRE_COSY_SMOKE,
x, y+2, z,
1,
0.0, 0.0, 0.0,
0.01
)
}
}
override fun getAmbientSound(): SoundEvent {
return MSoundEvents.LOADER_AMBIENT
}