Check before casting to mob (#1281)

fixes #1278
This commit is contained in:
Adam
2021-02-23 10:39:41 -08:00
committed by GitHub
parent e0f7e3c887
commit b3774efad8
@@ -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;