mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-31 12:23:51 -07:00
SPIGOT-4339: Add EntityTransformEvent
Thanks klugemonkey for some contributions in https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/351/overview
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
--- a/net/minecraft/server/EntityZombieVillager.java
|
||||
+++ b/net/minecraft/server/EntityZombieVillager.java
|
||||
@@ -9,6 +9,7 @@
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class EntityZombieVillager extends EntityZombie {
|
||||
|
||||
@@ -9,6 +13,7 @@
|
||||
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.b);
|
||||
private int conversionTime;
|
||||
private UUID bD;
|
||||
@@ -8,7 +19,7 @@
|
||||
|
||||
public EntityZombieVillager(World world) {
|
||||
super(EntityTypes.ZOMBIE_VILLAGER, world);
|
||||
@@ -54,8 +55,13 @@
|
||||
@@ -54,8 +59,13 @@
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@@ -23,7 +34,7 @@
|
||||
|
||||
this.conversionTime -= i;
|
||||
if (this.conversionTime <= 0) {
|
||||
@@ -100,8 +106,10 @@
|
||||
@@ -100,8 +110,10 @@
|
||||
this.bD = uuid;
|
||||
this.conversionTime = i;
|
||||
this.getDataWatcher().set(EntityZombieVillager.a, Boolean.valueOf(true));
|
||||
@@ -36,16 +47,21 @@
|
||||
this.world.broadcastEntityEffect(this, (byte) 16);
|
||||
}
|
||||
|
||||
@@ -123,7 +131,7 @@
|
||||
@@ -123,7 +135,12 @@
|
||||
entityvillager.setCustomNameVisible(this.getCustomNameVisible());
|
||||
}
|
||||
|
||||
- this.world.addEntity(entityvillager);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entityvillager, EntityTransformEvent.TransformReason.CURED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ 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 @@
|
||||
@@ -132,7 +149,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user