Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-111442

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 16w50a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12 Pre-Release 5, Minecraft 1.12.2, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w02a, Minecraft 18w03b, Minecraft 18w05a, Minecraft 1.13.2, Minecraft 18w43b, Minecraft 18w43c, Minecraft 18w44a, Minecraft 18w45a, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 19w11b, Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 1, Minecraft 1.14.4 Pre-Release 3, Minecraft 1.14.4 Pre-Release 4, Minecraft 1.14.4 Pre-Release 5, Minecraft 1.14.4 Pre-Release 6, 1.14.4, 19w34a, 19w35a, 19w36a, 19w37a, 19w38b, 19w39a, 19w40a, 19w41a, 19w42a, 19w45b, 19w46b, 1.15 Pre-release 1, 1.15 Pre-Release 2, 1.15 Pre-release 3, 1.15 Pre-release 4, 1.15 Pre-release 5, 1.15 Pre-release 6, 1.15 Pre-release 7, 1.15, 1.15.1, 1.15.1 Pre-release 1, 1.15.2 Pre-Release 1, 1.15.2 Pre-release 2, 1.15.2, 20w06a, 20w07a, 20w08a, 20w09a, 20w10a, 20w11a, 20w13a, 20w13b, 20w15a, 20w17a, 20w18a, 20w19a, 20w20a, 20w20b, 20w21a, 1.16 Pre-release 3, 1.16 Pre-release 8, 1.16 Release Candidate 1, 1.16, 1.16.1, 20w28a, 20w30a, 1.16.2 Pre-release 1, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w46a, 20w48a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w07a, 21w08b, 21w11a, 21w17a, 1.17 Pre-release 2, 1.17.1, 21w41a, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.20.1, 1.20.2 Release Candidate 2
    • Confirmed
    • Entities
    • Low
    • Gameplay

      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 Thumpbacker

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

        1. MC-111442.mp4
          6.20 MB
        2. MC-111442.png
          MC-111442.png
          890 kB

            Unassigned Unassigned
            muksterz mukster z
            Votes:
            37 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              CHK: