3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00

SPIGOT-4943: Zombie villager conversion player API.

Also resetting the conversion player when stopping a conversion.
Dieser Commit ist enthalten in:
blablubbabc 2019-05-17 14:08:33 +02:00 committet von md_5
Ursprung 5a02707175
Commit 9bda413457
2 geänderte Dateien mit 20 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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();
}
}