Paper/nms-patches/EntityZombieVillager.patch
2018-07-15 10:00:00 +10:00

32 lines
1.4 KiB
Diff

--- a/net/minecraft/server/EntityZombieVillager.java
+++ b/net/minecraft/server/EntityZombieVillager.java
@@ -9,6 +9,7 @@
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.b);
private int conversionTime;
private UUID bD;
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
public EntityZombieVillager(World world) {
super(EntityTypes.ZOMBIE_VILLAGER, world);
@@ -56,6 +57,11 @@
public void tick() {
if (!this.world.isClientSide && this.isConverting()) {
int i = this.dK();
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
+ this.lastTick = MinecraftServer.currentTick;
+ i *= elapsedTicks;
+ // CraftBukkit end
this.conversionTime -= i;
if (this.conversionTime <= 0) {
@@ -123,7 +129,7 @@
entityvillager.setCustomNameVisible(this.getCustomNameVisible());
}
- this.world.addEntity(entityvillager);
+ this.world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason
if (this.bD != null) {
EntityHuman entityhuman = this.world.b(this.bD);