Minecraft, server crashes on mob spawn 1.9
The code I am using to spawn and edit the zombies is as follows:
double strength = (int) (((wave * 100) + 50) / 50); Location location = new Location(loc.getLocation().getWorld(), loc.getLocation().getBlockX(), loc.getLocation().getBlockY(), loc.getLocation().getBlockZ()); location.add(0.5, 0, 0.5); Zombie zomb = (Zombie) location.getWorld().spawnEntity(location, EntityType.ZOMBIE); zomb.setBaby(false); setFollowDistance(zomb); setTotalHealth(zomb, strength); zomb.setHealth(strength <= 20D ? strength : 20D);
But whenever this runs and a zombie spawns, the server will register this and spawn the zombie in the right place. But when it does, it will freeze the zombie and then the server will crash. Thanks.
(I can't comment yet but try to take this as one and a possible answer)
According to my knowledge, you can't spawn entities with more than 2048 HP, that causes a server error (and maybe a crash on recent versions).