Trying to replace Vanilla Zombie with custom entity. With code, I am having random game hangs. Only Occasionally so its hard to tell exact problem. Game occasionally hangs at 100% when loading. Other times it hangs when playing. Never crashes, just everything freezes except player, Player can still move around in loaded chucks but cant interact with anything. Any ideas?
@SubscribeEvent
public void copyZombie(final EntityJoinWorldEvent event) {
World world = event.getEntity().world;
if (!world.isRemote) {
if (event.getEntity() instanceof ZombieEntity) {
if (!(event.getEntity() instanceof ZombieCopyEntity)) {
ZombieEntity zombie = (ZombieEntity) event.getEntity();
ZombieCopyEntity copy = new ZombieCopyEntity(EntityReg.ZOMBIECOPY, world);
copy.setPosition(zombie.getPosition().getX(), zombie.getPosition().getY(), zombie.getPosition().getZ());
event.setCanceled(true);
world.addEntity(copy);
}
}
}
}