From 0af0259050b4e0fc29d75ad06b7062cb1d4aea42 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 24 Jun 2020 08:52:40 +1000 Subject: [PATCH] SPIGOT-5797: Zombie(Villagers) Instant Convert based on their lifetime By: md_5 --- paper-server/nms-patches/EntityZombie.patch | 11 +++++++++-- paper-server/nms-patches/EntityZombieVillager.patch | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/paper-server/nms-patches/EntityZombie.patch b/paper-server/nms-patches/EntityZombie.patch index fa1f5b6f76..239356c679 100644 --- a/paper-server/nms-patches/EntityZombie.patch +++ b/paper-server/nms-patches/EntityZombie.patch @@ -24,19 +24,26 @@ public EntityZombie(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -144,7 +154,11 @@ +@@ -144,7 +154,10 @@ public void tick() { if (!this.world.isClientSide && this.isAlive()) { if (this.isDrownConverting()) { - --this.drownedConversionTime; + // CraftBukkit start - Use wall time instead of ticks for conversion + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; -+ this.lastTick = MinecraftServer.currentTick; + this.drownedConversionTime -= elapsedTicks; + // CraftBukkit end if (this.drownedConversionTime < 0) { this.ev(); } +@@ -161,6 +174,7 @@ + } + + super.tick(); ++ this.lastTick = MinecraftServer.currentTick; // CraftBukkit + } + + @Override @@ -193,6 +207,7 @@ } diff --git a/paper-server/nms-patches/EntityZombieVillager.patch b/paper-server/nms-patches/EntityZombieVillager.patch index 472bb84d2d..d1b7bd7de9 100644 --- a/paper-server/nms-patches/EntityZombieVillager.patch +++ b/paper-server/nms-patches/EntityZombieVillager.patch @@ -20,18 +20,25 @@ public EntityZombieVillager(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -75,6 +81,11 @@ +@@ -75,6 +81,10 @@ public void tick() { if (!this.world.isClientSide && this.isAlive() && this.isConverting()) { int i = this.getConversionProgress(); + // 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) { +@@ -83,6 +93,7 @@ + } + + super.tick(); ++ this.lastTick = MinecraftServer.currentTick; // CraftBukkit + } + + @Override @@ -123,8 +134,11 @@ this.conversionPlayer = uuid; this.conversionTime = i;