Steps to Reproduce:
run /give @p shield[unbreakable={},blocks_attacks={damage_reductions:[{type:["minecraft:generic_kill"],base:0,factor:1,horizontal_blocking_angle:180}]}] to get a Special Shield;
place a Command Block and a Pressure Plate;
step on the Pressure Plate while using Special Shield to block;
You can see “Killed Player“ but you are still alive.
How to Fix:
The current implementation of the LivingEntity#kill method is:
@Override
public void kill(final ServerLevel level) {
this.hurtServer(level, this.damageSources().genericKill(), Float.MAX_VALUE);
}It only needs to be changed to:
@Override
public void kill(final ServerLevel level) {
this.killLivingEntity(level);
}
private final void killLivingEntity(final ServerLevel level) {
float originalDamage = Float.MAX_VALUE;
float damage = Float.MAX_VALUE;
DamageSource source = this.damageSources().genericKill();
boolean blocked = false;
this.stopSleeping();
this.noActionTime = 0;
this.lastHurt = damage;
this.damageCooldownTime = 20;
this.setAbsorptionAmount(0.0F);
this.getCombatTracker().recordDamage(source, dmg);
this.setHealth(0.0F);
this.gameEvent(GameEvent.ENTITY_DAMAGE);
this.hurtDuration = 10;
this.hurtTime = this.hurtDuration;
this.resolveMobResponsibleForDamage(source);
this.resolvePlayerResponsibleForDamage(source);
level.broadcastDamageEvent(this, source);
this.markHurt();
this.makeSound(this.getDeathSound());
this.playSecondaryHurtSound(source);
this.die(this.damageSources().genericKill());
this.setLastDamageSource(source);
for (MobEffectInstance effect : this.getActiveEffects()) {
effect.onMobHurt(level, this, source, damage);
}
if (this instanceof ServerPlayer serverPlayer) {
CriteriaTriggers.ENTITY_HURT_PLAYER.trigger(serverPlayer, source, originalDamage, damage, blocked);
}
}and it will be fixed.
Comments 0
No comments.