2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
|
|
|
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
|
|
|
@@ -47,6 +47,13 @@
|
|
|
|
import net.minecraft.world.level.block.Blocks;
|
2020-06-25 02:00:00 +02:00
|
|
|
import org.apache.logging.log4j.Logger;
|
2021-03-08 22:47:33 +01:00
|
|
|
|
2018-11-14 04:10:22 +01:00
|
|
|
+// CraftBukkit start
|
2021-03-15 23:00:00 +01:00
|
|
|
+import net.minecraft.server.MinecraftServer;
|
2019-07-26 01:58:18 +02:00
|
|
|
+import org.bukkit.entity.ZombieVillager;
|
2020-08-11 23:00:00 +02:00
|
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
2018-11-14 04:10:22 +01:00
|
|
|
+import org.bukkit.event.entity.EntityTransformEvent;
|
|
|
|
+// CraftBukkit end
|
2021-03-08 22:47:33 +01:00
|
|
|
+
|
2019-04-23 04:00:00 +02:00
|
|
|
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
2018-11-14 04:10:22 +01:00
|
|
|
|
2021-03-08 22:47:33 +01:00
|
|
|
public static final DataWatcherObject<Boolean> CONVERTING = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i);
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -56,6 +63,7 @@
|
2020-08-11 23:00:00 +02:00
|
|
|
private NBTBase bp;
|
|
|
|
private NBTTagCompound bq;
|
|
|
|
private int br;
|
2016-11-17 02:41:03 +01:00
|
|
|
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
|
|
|
|
super(entitytypes, world);
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -72,7 +80,7 @@
|
2020-06-25 02:00:00 +02:00
|
|
|
@Override
|
|
|
|
public void saveData(NBTTagCompound nbttagcompound) {
|
|
|
|
super.saveData(nbttagcompound);
|
|
|
|
- DataResult dataresult = VillagerData.a.encodeStart(DynamicOpsNBT.a, this.getVillagerData());
|
|
|
|
+ DataResult<NBTBase> dataresult = VillagerData.a.encodeStart(DynamicOpsNBT.a, this.getVillagerData()); // CraftBukkit - decompile error
|
|
|
|
Logger logger = EntityZombieVillager.LOGGER;
|
|
|
|
|
|
|
|
logger.getClass();
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -128,6 +136,10 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
public void tick() {
|
2019-04-23 04:00:00 +02:00
|
|
|
if (!this.world.isClientSide && this.isAlive() && this.isConverting()) {
|
|
|
|
int i = this.getConversionProgress();
|
2016-11-17 02:41:03 +01:00
|
|
|
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
|
|
|
|
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
|
|
|
+ i *= elapsedTicks;
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
this.conversionTime -= i;
|
|
|
|
if (this.conversionTime <= 0) {
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -136,6 +148,7 @@
|
2020-06-24 00:52:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
super.tick();
|
|
|
|
+ this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -179,13 +192,22 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
this.conversionPlayer = uuid;
|
2018-07-20 08:04:37 +02:00
|
|
|
this.conversionTime = i;
|
2018-12-25 22:00:00 +01:00
|
|
|
this.getDataWatcher().set(EntityZombieVillager.CONVERTING, true);
|
2018-07-20 08:04:37 +02:00
|
|
|
- this.removeEffect(MobEffects.WEAKNESS);
|
|
|
|
- this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0)));
|
|
|
|
+ // CraftBukkit start
|
2019-04-08 12:29:18 +02:00
|
|
|
+ this.persistent = true; // CraftBukkit - SPIGOT-4684 update persistence
|
2018-07-20 08:04:37 +02:00
|
|
|
+ this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
|
|
|
+ this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
|
|
|
+ // CraftBukkit end
|
|
|
|
this.world.broadcastEntityEffect(this, (byte) 16);
|
|
|
|
}
|
|
|
|
|
2020-08-11 23:00:00 +02:00
|
|
|
private void c(WorldServer worldserver) {
|
|
|
|
- EntityVillager entityvillager = (EntityVillager) this.a(EntityTypes.VILLAGER, false);
|
2018-11-14 04:10:22 +01:00
|
|
|
+ // CraftBukkit start
|
2020-08-11 23:00:00 +02:00
|
|
|
+ EntityVillager entityvillager = (EntityVillager) this.a(EntityTypes.VILLAGER, false, EntityTransformEvent.TransformReason.CURED, CreatureSpawnEvent.SpawnReason.CURED);
|
|
|
|
+ if (entityvillager == null) {
|
2019-07-26 01:58:18 +02:00
|
|
|
+ ((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam
|
2018-11-14 04:10:22 +01:00
|
|
|
+ return;
|
|
|
|
+ }
|
2018-12-04 23:51:20 +01:00
|
|
|
+ // CraftBukkit end
|
2020-08-11 23:00:00 +02:00
|
|
|
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
|
|
|
int i = aenumitemslot.length;
|
2017-05-14 04:00:00 +02:00
|
|
|
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -226,7 +248,7 @@
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
|
|
|
+ entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
|
2020-06-25 02:00:00 +02:00
|
|
|
if (!this.isSilent()) {
|
|
|
|
worldserver.a((EntityHuman) null, 1027, this.getChunkCoordinates(), 0);
|
|
|
|
}
|