[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. 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. |