Skip to content

Instantly share code, notes, and snippets.

@anna-is-cute
Created January 30, 2014 01:02
Show Gist options
  • Save anna-is-cute/8700669 to your computer and use it in GitHub Desktop.
Save anna-is-cute/8700669 to your computer and use it in GitHub Desktop.
@EventHandler(priority = EventPriority.HIGH)
public void zombieIsMasterRace(CreatureSpawnEvent e) {
if (e.getEntityType() == EntityType.ZOMBIE) { // convert ALL zombies in ALL worlds
if (ZombieSpawner.getSurvivorsZombie((Zombie) e.getEntity()) == null) {
e.setCancelled(true);
ZombieSpawner.spawnLeveledZombie(e.getLocation());
}
return;
}
final Entity entity = e.getEntity();
if (!RUtils.isInInfectedWorld(entity)) return; // abnormal monster spawn only in infected worlds
if (!(entity instanceof Monster) && !(entity instanceof Slime)) return;
e.setCancelled(true);
ZombieSpawner.spawnLeveledZombie(e.getLocation());
}
@EventHandler(priority = EventPriority.HIGHEST)
public void noVanillaZombiesWhatsoever(CreatureSpawnEvent e) {
if (e.getEntityType() != EntityType.ZOMBIE) return;
if (ZombieSpawner.getSurvivorsZombie((Zombie) e.getEntity()) != null) return;
e.setCancelled(true);
System.out.println("Blocked a vanilla zombie from spawning. This is a bug."); // fires whenever a zombie is spawned manually via command but not by egg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment