From 1c225d93f9f151dbf85a478f6cdb6bd5365e8255 Mon Sep 17 00:00:00 2001 From: Maroon28 <74205260+Maroon28@users.noreply.github.com> Date: Sat, 7 Aug 2021 16:05:18 +0200 Subject: [PATCH] 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 --- changelog.md | 1 + .../java/com/garbagemule/MobArena/waves/MACreature.java | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/changelog.md b/changelog.md index 0b57f19..afebb9e 100644 --- a/changelog.md +++ b/changelog.md @@ -24,6 +24,7 @@ These changes will (most likely) be included in the next version. ### Fixed - Pillagers and vindicators no longer spawn without their much-needed weapons. +- Piglins, piglin brutes, and hoglins no longer zombify. This fixes a bug where the mobs would despawn due to the zombification process. - Reward groups with `nothing` in them no longer cause errors when earned/granted. ## [0.106] - 2021-05-09 diff --git a/src/main/java/com/garbagemule/MobArena/waves/MACreature.java b/src/main/java/com/garbagemule/MobArena/waves/MACreature.java index 774c2ce..12ce1ca 100644 --- a/src/main/java/com/garbagemule/MobArena/waves/MACreature.java +++ b/src/main/java/com/garbagemule/MobArena/waves/MACreature.java @@ -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; }