[SPIGOT-6075] Snowballs not destroy Endercrystals. Created: 14/Aug/20  Updated: 17/Aug/20  Resolved: 17/Aug/20

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Foorcee Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version: 1.16.2
Guidelines Read: Yes

 Description   

A snowball doesn't do any damage, so the event is always cancelled. In Vanilla, however, they still destroy EnderCrystals.

Source: EntityEnderCrystal, Method: damageEntity

if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, (double)f)) {
        return false;
 }

The method fires the event, where the event is canceled when the damage is zero.
If you set the damage in the event to greater than zero it works like in Vanilla.

Although the method contains a condition for this, the DamageSource of a snowball is an instance of the EntityDamageSourceSourceIndirect class.

Source CraftEventFactory, Method: handleNonLivingEntityDamageEvent(entity, source, damage, cancelOnZeroDamage, cancelled)

        if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) {
            return false;
        }
    public static DamageSource projectile(Entity entity, @Nullable Entity entity1) {
        return (new EntityDamageSourceIndirect("thrown", entity, entity1)).c();
    }


 Comments   
Comment by Parker Hawke [ 16/Aug/20 ]

Much simpler fix for this, I've gone ahead and written a PR.
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/728/

Generated at Sat Dec 13 15:21:33 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.