Make piglins and hoglins immune to zombification

When piglins, piglin brutes, and hoglins go through zombification, the current entity is removed, and a new one spawns. MobArena prevents the zombified entity from spawning, so it feels like the mobs just "vanish".

We don't actually want the mobs to zombify, however, so this commit makes them immune to the zombification process. Note that this shouldn't cause any problems on server versions prior to 1.16, because the piglin and hoglin keys never get registered on those versions, so there is no risk of hitting those branches in the `switch` statement.

Fixes #684

Co-authored-by: Andreas Troelsen <[email protected]>
This commit is contained in:
Maroon28
2021-08-07 16:05:18 +02:00
committed by GitHub
co-authored by Andreas Troelsen
parent 6be130daf1
commit 1c225d93f9
2 changed files with 10 additions and 0 deletions
@@ -12,6 +12,8 @@ import org.bukkit.entity.Creature;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Hoglin;
import org.bukkit.entity.PiglinAbstract;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Sheep;
@@ -146,6 +148,13 @@ public class MACreature {
case "killerbunny":
((Rabbit) e).setRabbitType(Rabbit.Type.THE_KILLER_BUNNY);
break;
case "piglin":
case "piglinbrute":
((PiglinAbstract) e).setImmuneToZombification(true);
break;
case "hoglin":
((Hoglin) e).setImmuneToZombification(true);
break;
default:
break;
}