Check before casting to mob (#1281)

fixes #1278
This commit is contained in:
Adam 2021-02-23 13:39:41 -05:00 committed by GitHub
parent e0f7e3c887
commit b3774efad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -659,7 +659,7 @@ public class EntityEventHandler implements Listener
if (type == EntityType.PANDA)
return ((Panda) entity).getMainGene() == Panda.Gene.AGGRESSIVE;
if (type == EntityType.HOGLIN || type == EntityType.POLAR_BEAR)
if ((type == EntityType.HOGLIN || type == EntityType.POLAR_BEAR) && entity instanceof Mob)
return !entity.getPersistentDataContainer().has(luredByPlayer, PersistentDataType.BYTE) && ((Mob) entity).getTarget() != null;
return false;