The Bug:
Slimes, magma cubes, pufferfish, and ender dragons can consume the durability of shields within seconds.
This most likely has something to do with how these mobs have little to no attack cooldown.
Steps to Reproduce:
Summon a large slime by using the command provided below.
/summon minecraft:slime ~ ~ ~ {Size:4,Attributes:[{Base:0.0d,Name:"minecraft:generic.movement_speed"}]}
Switch into survival mode, obtain a shield, start blocking with it, and slowly approach the slime.
Wait for it to begin attacking you.
Look at the durability of your shield closely.
Take note as to whether or not slimes, magma cubes, pufferfish, and ender dragons can consume the durability of shields within seconds.
Observed Behavior:
Slimes, magma cubes, pufferfish, and ender dragons can consume the durability of shields within seconds.
Expected Behavior:
Slimes, magma cubes, pufferfish, and ender dragons would not be able to consume the durability of shields within seconds.
Linked issues
is duplicated by 14
relates to 3
Attachments
Comments 20
This can be a problem when defending against magma cubes in basalt deltas. This problem is worse with MC-147694, as magma cubes don't get repelled, and continue to disintegrate the shield.
This report may be benefited from being renamed to "Slimes, magma cubes, pufferfish, and ender dragons have no attacking delay, quickly draining the durability of shields", to clarify why this issue happens and how it would be fixed (giving these mobs appropriate delays between attacks like other mobs).
Ender dragon has a 2 tick cooldown on attack (checks when was the last time the entity was hit) but only for wings. Head attack has no cooldown so you (well, your shield) take damage 20 times / sec.
This can be easily fixed.
Minecraft 1.20.1 using Parchment mappings.
private void knockBack(List<Entity> pEntities) {
double d0 = (this.body.getBoundingBox().minX + this.body.getBoundingBox().maxX) / 2.0D;
double d1 = (this.body.getBoundingBox().minZ + this.body.getBoundingBox().maxZ) / 2.0D;
for(Entity entity : pEntities) {
if (entity instanceof LivingEntity) {
double d2 = entity.getX() - d0;
double d3 = entity.getZ() - d1;
double d4 = Math.max(d2 * d2 + d3 * d3, 0.1D);
entity.push(d2 / d4 * 4.0D, (double)0.2F, d3 / d4 * 4.0D);
// if (!this.phaseManager.getCurrentPhase().isSitting() && ((LivingEntity)entity).getLastHurtByMobTimestamp() < entity.tickCount - 2) { original check
if (!this.phaseManager.getCurrentPhase().isSitting() && (((LivingEntity)entity).getLastHurtByMobTimestamp() < entity.tickCount - 10 || ((LivingEntity)entity).getLastHurtByMob() != this)) {
entity.hurt(this.damageSources().mobAttack(this), 5.0F);
this.doEnchantDamageEffects(this, entity);
}
}
}
}
As for the head damage, a new conditions must be added like the one above
private void hurt(List<Entity> pEntities) {
for(Entity entity : pEntities) {
// if (entity instanceof LivingEntity) { original
if (entity instanceof LivingEntity && (((LivingEntity)entity).getLastHurtByMobTimestamp() < entity.tickCount - 10 || ((LivingEntity)entity).getLastHurtByMob() != this)) {
entity.hurt(this.damageSources().mobAttack(this), 10.0F);
this.doEnchantDamageEffects(this, entity);
}
}
}
Duplicate of MC-151359