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
- 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 - Load a firework into the crossbow
- Summon one of the affected entities listed above
- 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 [Mod] Anthony Cicinelli
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
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
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; } ...
2016-12-15, 11:58 PM
2024-04-18, 07:13 PM
38
22
boat, damage, end_crystal, ender_dragon, fireworks, item_frame, lead, minecart, painting
Minecraft 16w50a - 1.20.2 Release Candidate 2
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
-