mojira.dev
MC-169167

Slimes, magma cubes, pufferfish, and ender dragons can consume the durability of shields within seconds

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:

  1. Summon a large slime by using the command provided below.

    /summon minecraft:slime ~ ~ ~ {Size:4,Attributes:[{Base:0.0d,Name:"minecraft:generic.movement_speed"}]}
  1. Switch into survival mode, obtain a shield, start blocking with it, and slowly approach the slime.

  2. Wait for it to begin attacking you.

  3. Look at the durability of your shield closely.

  4. 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

MC-151359 Slime attack too quickly, breaking shields in seconds Resolved MC-199213 Shield gets spammed hit when defending against magma cube Resolved MC-208462 Magma Cube hitting sheild 50+ times in 1 sec Resolved MC-210306 Slimes instantly break shields Resolved MC-215718 shields break very fast whehn blocking slimes Resolved

Attachments

Comments 20

Using this ticket as parent instead.

gaspoweredpick

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.

The loud sound scared me so much ._.

gaspoweredpick

Confirmed for ender dragons. When flying into your shield, they damage the shield way too much.

10 more comments

This also affects pufferfish.

Can confirm in 24w20a

Can confirm in 1.21.

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);
      }
   }

}

El_Redstoniano

Avoma

(Unassigned)

Confirmed

Gameplay

Important

Combat, Mob behaviour

ender_dragon, magma_cube, mojang_internal_1, pufferfish, shield, slime

Minecraft 1.14, 1.15.1, 1.15.2, 20w13b, 20w17a, ..., 24w36a, 1.21.3, 1.21.4, 25w08a, 1.21.7

Retrieved