mojira.dev
MC-111442

Firework explosions don't damage ender dragons, end crystals, boats, minecarts, paintings, item frames, or leash knots

The bug

Firework explosions don't deal damage to numerous amounts of entities.

Affected entities

  • Ender dragons

  • End crystals

  • Boats

  • Minecarts

  • Paintings

  • Item frames

  • Leads

How to reproduce

  1. Obtain a crossbow and some fireworks

    /give @s minecraft:crossbow
    /give @s minecraft:firework_rocket{Fireworks:{Flight:1,Explosions:[{Type:1,Flicker:1,Trail:1,Colors:[I;12801229],FadeColors:[I;11743532]}]}} 64
  2. Load a firework into the crossbow

  3. Summon one of the affected entities listed above

  4. Take note as to whether or not the entity of your choice is damaged by the firework explosion
    → ❌ Firework explosions don't deal damage to numerous amounts of entities.

Expected behavior

Firework explosions would deal damage to all entities.

Code Analysis

Code analysis done by @unknown

The reason this is happening is that when the explosion damage is happening it only checks from living entities which excludes End Crystals and Ender Dragons. Changing it to check for all Entities fixes it

Current Code

net/minecraft/world/entity/projectile/FireworkRocketEntity.java

private void dealExplosionDamage() {
...
         for(LivingEntity livingentity : this.level.getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(5.0D))) {
            if (livingentity != this.attachedToEntity && !(this.distanceToSqr(livingentity) > 25.0D)) {
               boolean flag = false;

               for(int i = 0; i < 2; ++i) {
                  Vec3 vec31 = new Vec3(livingentity.getX(), livingentity.getY(0.5D * (double)i), livingentity.getZ());
                  HitResult hitresult = this.level.clip(new ClipContext(vec3, vec31, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this));
                  if (hitresult.getType() == HitResult.Type.MISS) {
                     flag = true;
                     break;
                  }
               }
   }
...

Fixed Code

net/minecraft/world/entity/projectile/FireworkRocketEntity.java

private void dealExplosionDamage() {
...
         //Changing from Living Entity to Entity fixes MC-111442
         for(Entity entity: this.level.getEntitiesOfClass(Entity.class, this.getBoundingBox().inflate(5.0D))) {
            if (entity != this.attachedToEntity && !(this.distanceToSqr(livingentity) > 25.0D)) {
               boolean flag = false;

               for(int i = 0; i < 2; ++i) {
                  Vec3 vec31 = new Vec3(entity.getX(), entity.getY(0.5D * (double)i), entity.getZ());
                  HitResult hitresult = this.level.clip(new ClipContext(vec3, vec31, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this));
                  if (hitresult.getType() == HitResult.Type.MISS) {
                     flag = true;
                     break;
                  }
               }

               //Deny items and experience being destroyed by the rocket
               //Could probably be done better
               if(entity instanceof  ItemEntity || entity instanceof ExperienceOrb)
               {
                  flag = false;
               }
...

Linked issues

Attachments

Comments 27

We are unable to diagnose your issue due to the lack of proper debug information. Please review the guidelines before reporting issues.
In case of a game crash, please also attach the crash log from [minecraft/crash-reports/crash-<DATE>-client.txt|http://hopper.minecraft.net/help/finding-minecraft-data-folder].

-- I am a bot. This action was performed automagically!

Confirmed in 1.11.2

Can confirm for 1.13.2 and 18w43c. The fireworks shot by the new crossbow don't damage to any of these entities. This should be fixed before the Village and Pillage release because blowing up the ender dragon would be a great way to beat the game.

this bug still exists in the 1.14 snapshot 18w49a it would be awesome if this could be fixed

17 more comments

Can confirm in 1.19.

Can confirm in 1.19.1.

Can confirm in 1.19.2.

While obviously a bug, if fixed, the fireworks' ability to destroy End crystals might have balance implications as one could just climb onto an End spike and easily destroy crystals on nearby spikes with rockets. Using arrows or snowballs for the same requires some targeting skill as they follow an arcing trajectory - with crossbows (or "rocket propelled grenade launchers" if you ask me) you would just point and shoot. It would trivialize the Ender Dragon fight even further.

I was able to damage the Ender Dragon with fireworks in 1.20.5-RC1, but not any of the other entities listed.

mukster z

(Unassigned)

Confirmed

Gameplay

Low

Entities

boat, damage, end_crystal, ender_dragon, fireworks, item_frame, lead, minecart, painting

Minecraft 16w50a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12 Pre-Release 5, Minecraft 1.12.2, ..., 1.19.1, 1.19.2, 1.19.3, 1.20.1, 1.20.2 Release Candidate 2

Retrieved