mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 13:06:02 +01:00
54 lines
2.5 KiB
Diff
54 lines
2.5 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) {
|
|
@@ -100,8 +106,10 @@
|
|
this.bD = uuid;
|
|
this.conversionTime = i;
|
|
this.getDataWatcher().set(EntityZombieVillager.a, Boolean.valueOf(true));
|
|
- this.removeEffect(MobEffects.WEAKNESS);
|
|
- this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0)));
|
|
+ // CraftBukkit start
|
|
+ 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);
|
|
}
|
|
|
|
@@ -123,7 +131,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);
|
|
|
|
@@ -132,7 +140,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
|
|
this.world.a((EntityHuman) null, 1027, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
|
|
}
|
|
|