I might be wrong, but looking at the code it shouldn't be fixed:
public boolean onBeingHit(EntityDamageByEntityEvent evt, int level, boolean usedHand) {
if (!(evt.getEntity() instanceof LivingEntity) ||
!ADAPTER.attackEntity((LivingEntity) evt.getEntity(), (Player) evt.getDamager(), 0)) {
return true;
}
}
We have already established that evt.getEntity() is not of instance of LivingEntity, so why cast it into a LivingEntity?
The same goes for evt.getDamager(). I assume evt.getDamager() and evt.getEntity() were mixed up?
I might be wrong, but looking at the code it shouldn't be fixed:
We have already established that
evt.getEntity()
is not of instance ofLivingEntity
, so why cast it into aLivingEntity
? The same goes forevt.getDamager()
. I assumeevt.getDamager()
andevt.getEntity()
were mixed up?Originally posted by @Geolykt in https://github.com/Zedly/Zenchantments/issues/36#issuecomment-655750115