2019-04-08 10:31:50 +00:00
From 9bc9364e7302259806103f562cccd56e0b88b9c4 Mon Sep 17 00:00:00 2001
2018-07-30 03:54:13 +00:00
From: Anthony MacAllister <anthonymmacallister@gmail.com>
Date: Thu, 26 Jul 2018 15:30:03 -0400
Subject: [PATCH] EntityTransformedEvent
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
2019-03-20 01:46:00 +00:00
index 141c17bf8..dde9f1e61 100644
2018-07-30 03:54:13 +00:00
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
2018-11-14 04:21:32 +00:00
@@ -53,6 +53,7 @@ public class EntityMushroomCow extends EntityCow {
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
return false;
2018-07-30 03:54:13 +00:00
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return false; // Paper
2018-11-14 04:21:32 +00:00
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
2018-07-30 03:54:13 +00:00
2018-12-08 10:09:55 +00:00
this.die(); // CraftBukkit - from above
2018-07-30 03:54:13 +00:00
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
2019-03-20 01:46:00 +00:00
index 78acac4ca..f01e776fe 100644
2018-07-30 03:54:13 +00:00
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
2019-01-01 03:15:55 +00:00
@@ -624,6 +624,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
2018-11-14 04:21:32 +00:00
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
return;
2018-07-30 03:54:13 +00:00
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper
2018-11-14 04:21:32 +00:00
this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
// CraftBukkit end
2018-07-30 03:54:13 +00:00
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
2019-03-20 01:46:00 +00:00
index 7a943a6c2..7998b80c1 100644
2018-07-30 03:54:13 +00:00
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
2019-01-15 21:12:19 +00:00
@@ -239,6 +239,7 @@ public class EntityZombie extends EntityMonster {
2018-11-14 04:21:32 +00:00
return;
2018-07-30 03:54:13 +00:00
}
2018-11-14 04:21:32 +00:00
// CraftBukkit end
2018-07-30 03:54:13 +00:00
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityzombie.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return; // Paper
2018-07-30 04:12:03 +00:00
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.DROWNED); // CraftBukkit - added spawn reason
2018-07-30 03:54:13 +00:00
this.die();
}
2019-01-15 21:12:19 +00:00
@@ -401,6 +402,7 @@ public class EntityZombie extends EntityMonster {
2018-12-08 10:09:55 +00:00
if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
2018-11-14 04:21:32 +00:00
return;
2018-07-30 03:54:13 +00:00
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.INFECTED).callEvent()) return; // Paper
2018-12-08 10:09:55 +00:00
this.world.kill(entityvillager); // CraftBukkit - from above
2018-07-30 03:54:13 +00:00
this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
2018-12-08 10:09:55 +00:00
// CraftBukkit end
2018-07-30 03:54:13 +00:00
diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java
2019-04-08 10:31:50 +00:00
index 670e38eb8..359ac8b88 100644
2018-07-30 03:54:13 +00:00
--- a/src/main/java/net/minecraft/server/EntityZombieVillager.java
+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java
2019-04-08 10:31:50 +00:00
@@ -140,6 +140,7 @@ public class EntityZombieVillager extends EntityZombie {
2018-12-08 10:09:55 +00:00
if (CraftEventFactory.callEntityTransformEvent(this, entityvillager, EntityTransformEvent.TransformReason.CURED).isCancelled()) {
2018-11-14 04:21:32 +00:00
return;
2018-07-30 03:54:13 +00:00
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.CURED).callEvent()) return; // Paper
2018-12-08 10:09:55 +00:00
this.world.kill(this); // CraftBukkit - from above
2018-07-30 03:54:13 +00:00
this.world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason
2018-12-08 10:09:55 +00:00
// CraftBukkit end
2018-07-30 03:54:13 +00:00
--
2019-03-20 01:46:00 +00:00
2.21.0
2018-07-30 03:54:13 +00:00