Change from Cancelable to using a Result. This means you can force despawn mobs you

don't want around anymore. Also, deferred check to once every 20 ticks. May tune it
down further or make it a config if this event is a lag issue.
This commit is contained in:
Christian committed 2013-09-06 16:05:29 -04:00
1 parent ff655de27e
commit d9ca67e162
3 files changed
+31 -15

No files matched your search

@@ -60,9 +60,11 @@ public class ForgeEventFactory
return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z));
}
public static boolean canEntityDespawn(EntityLiving entity)
public static Result canEntityDespawn(EntityLiving entity)
{
return !MinecraftForge.EVENT_BUS.post(new AllowDespawn(entity));
AllowDespawn event = new AllowDespawn(entity);
MinecraftForge.EVENT_BUS.post(event);
return event.getResult();
}
public static List getPotentialSpawns(WorldServer world, EnumCreatureType type, int x, int y, int z, List oldList)