diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch index 051d0aabf7..cb1e11c951 100644 --- a/nms-patches/EntityZombieVillager.patch +++ b/nms-patches/EntityZombieVillager.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityZombieVillager.java +++ b/net/minecraft/server/EntityZombieVillager.java -@@ -3,6 +3,10 @@ +@@ -3,15 +3,20 @@ import com.mojang.datafixers.Dynamic; import java.util.UUID; import javax.annotation.Nullable; @@ -11,8 +11,11 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder { -@@ -12,6 +16,7 @@ - private UUID conversionPlayer; + public static final DataWatcherObject CONVERTING = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i); + private static final DataWatcherObject c = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.q); + public int conversionTime; +- private UUID conversionPlayer; ++ public UUID conversionPlayer; // CraftBukkit - public private NBTTagCompound bB; private int bC; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java index df9d1069ee..98b6dcf47b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java @@ -7,6 +7,8 @@ import net.minecraft.server.EntityZombieVillager; import net.minecraft.server.IRegistry; import net.minecraft.server.MinecraftKey; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Villager; @@ -62,8 +64,20 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager { getHandle().conversionTime = -1; getHandle().getDataWatcher().set(EntityZombieVillager.CONVERTING, false); getHandle().persistent = false; // CraftBukkit - SPIGOT-4684 update persistence + getHandle().conversionPlayer = null; } else { getHandle().startConversion((UUID) null, time); } } + + @Override + public OfflinePlayer getConversionPlayer() { + return (getHandle().conversionPlayer == null) ? null : Bukkit.getOfflinePlayer(getHandle().conversionPlayer); + } + + @Override + public void setConversionPlayer(OfflinePlayer conversionPlayer) { + if (!this.isConverting()) return; + getHandle().conversionPlayer = (conversionPlayer == null) ? null : conversionPlayer.getUniqueId(); + } }