private void explode() { if (!EventFactory.getInstance().callEvent(new FireworkExplodeEvent(this)).isCancelled()) { this.playEffect(EntityEffect.FIREWORK_EXPLODE); int effectsSize = getFireworkMeta().getEffectsSize(); if (effectsSize > 0) { if (boostedEntity != null) { boostedEntity.damage((5 + effectsSize * 2), DamageCause.ENTITY_EXPLOSION); } List<Entity> nearbyEntities = this.getNearbyEntities(2.5, 2.5, 2.5); for (Entity nearbyEntity : nearbyEntities) { if (!(nearbyEntity instanceof LivingEntity)) { continue; } if (this.getLocation().distanceSquared(nearbyEntity.getLocation()) > 25) { continue; } // "The explosion of firework rockets deals 2.5 hearts of damage, per firework // star." ((LivingEntity) nearbyEntity) .damage((effectsSize * 5), DamageCause.ENTITY_EXPLOSION); } } } remove(); }