Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 04:50:05 +01:00
SPIGOT-4943: Zombie villager conversion player API.
Also resetting the conversion player when stopping a conversion.
Dieser Commit ist enthalten in:
Ursprung
5a02707175
Commit
9bda413457
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/server/EntityZombieVillager.java
|
--- a/net/minecraft/server/EntityZombieVillager.java
|
||||||
+++ b/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 com.mojang.datafixers.Dynamic;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -11,8 +11,11 @@
|
|||||||
|
|
||||||
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
||||||
|
|
||||||
@@ -12,6 +16,7 @@
|
public static final DataWatcherObject<Boolean> CONVERTING = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i);
|
||||||
private UUID conversionPlayer;
|
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 NBTTagCompound bB;
|
||||||
private int bC;
|
private int bC;
|
||||||
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
+ 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.IRegistry;
|
||||||
import net.minecraft.server.MinecraftKey;
|
import net.minecraft.server.MinecraftKey;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
@ -62,8 +64,20 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
|
|||||||
getHandle().conversionTime = -1;
|
getHandle().conversionTime = -1;
|
||||||
getHandle().getDataWatcher().set(EntityZombieVillager.CONVERTING, false);
|
getHandle().getDataWatcher().set(EntityZombieVillager.CONVERTING, false);
|
||||||
getHandle().persistent = false; // CraftBukkit - SPIGOT-4684 update persistence
|
getHandle().persistent = false; // CraftBukkit - SPIGOT-4684 update persistence
|
||||||
|
getHandle().conversionPlayer = null;
|
||||||
} else {
|
} else {
|
||||||
getHandle().startConversion((UUID) null, time);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren