aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/monster/EntityZombieVillager.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/monster/EntityZombieVillager.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/monster/EntityZombieVillager.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/monster/EntityZombieVillager.patch b/patch-remap/og/net/minecraft/world/entity/monster/EntityZombieVillager.patch
new file mode 100644
index 0000000000..bfa1832ada
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/monster/EntityZombieVillager.patch
@@ -0,0 +1,99 @@
+--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
++++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
+@@ -50,6 +50,13 @@
+ import org.joml.Vector3f;
+ import org.slf4j.Logger;
+
++// CraftBukkit start
++import net.minecraft.server.MinecraftServer;
++import org.bukkit.entity.ZombieVillager;
++import org.bukkit.event.entity.CreatureSpawnEvent;
++import org.bukkit.event.entity.EntityTransformEvent;
++// CraftBukkit end
++
+ public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
+
+ private static final Logger LOGGER = LogUtils.getLogger();
+@@ -67,6 +74,7 @@
+ @Nullable
+ private NBTTagCompound tradeOffers;
+ private int villagerXp;
++ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
+
+ public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
+ super(entitytypes, world);
+@@ -85,7 +93,7 @@
+ @Override
+ public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
+ super.addAdditionalSaveData(nbttagcompound);
+- DataResult dataresult = VillagerData.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.getVillagerData());
++ DataResult<NBTBase> dataresult = VillagerData.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.getVillagerData()); // CraftBukkit - decompile error
+ Logger logger = EntityZombieVillager.LOGGER;
+
+ Objects.requireNonNull(logger);
+@@ -141,6 +149,10 @@
+ public void tick() {
+ if (!this.level().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;
++ i *= elapsedTicks;
++ // CraftBukkit end
+
+ this.villagerConversionTime -= i;
+ if (this.villagerConversionTime <= 0) {
+@@ -149,6 +161,7 @@
+ }
+
+ super.tick();
++ this.lastTick = MinecraftServer.currentTick; // CraftBukkit
+ }
+
+ @Override
+@@ -192,8 +205,10 @@
+ this.conversionStarter = uuid;
+ this.villagerConversionTime = i;
+ this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
+- this.removeEffect(MobEffects.WEAKNESS);
+- this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level().getDifficulty().getId() - 1, 0)));
++ // CraftBukkit start
++ this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
++ this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level().getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
++ // CraftBukkit end
+ this.level().broadcastEntityEvent(this, (byte) 16);
+ }
+
+@@ -210,7 +225,13 @@
+ }
+
+ private void finishConversion(WorldServer worldserver) {
+- EntityVillager entityvillager = (EntityVillager) this.convertTo(EntityTypes.VILLAGER, false);
++ // CraftBukkit start
++ EntityVillager entityvillager = (EntityVillager) this.convertTo(EntityTypes.VILLAGER, false, EntityTransformEvent.TransformReason.CURED, CreatureSpawnEvent.SpawnReason.CURED);
++ if (entityvillager == null) {
++ ((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam
++ return;
++ }
++ // CraftBukkit end
+ EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
+ int i = aenumitemslot.length;
+
+@@ -225,7 +246,9 @@
+ double d0 = (double) this.getEquipmentDropChance(enumitemslot);
+
+ if (d0 > 1.0D) {
++ this.forceDrops = true; // CraftBukkit
+ this.spawnAtLocation(itemstack);
++ this.forceDrops = false; // CraftBukkit
+ }
+ }
+ }
+@@ -252,7 +275,7 @@
+ }
+ }
+
+- entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
++ entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
+ if (!this.isSilent()) {
+ worldserver.levelEvent((EntityHuman) null, 1027, this.blockPosition(), 0);
+ }