Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6075

Snowballs not destroy Endercrystals.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • 1.16.2
    • Yes

      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();
          }
      

            Unassigned Unassigned
            Foorcee Foorcee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: