mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 06:50:12 +01:00
SPIGOT-4943: Zombie villager conversion player API.
Also resetting the conversion player when stopping a conversion.
This commit is contained in:
parent
5a02707175
commit
9bda413457
2 changed files with 20 additions and 3 deletions
|
@ -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<Boolean> CONVERTING = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<VillagerData> 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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue