Paper/Spigot-Server-Patches/0255-EntityTransformedEvent.patch

67 lines
5.4 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-07-30 05:54:13 +02:00
From: Anthony MacAllister <anthonymmacallister@gmail.com>
Date: Thu, 26 Jul 2018 15:30:03 -0400
Subject: [PATCH] EntityTransformedEvent
2020-06-25 16:09:55 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index bb831658d91ffa7d78cd8597509e61f3f14b0890..8a79302b9cc178bfe4e0909293e3a87c01d344ca 100644
2020-06-25 16:09:55 +02:00
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1244,6 +1244,7 @@ public abstract class EntityInsentient extends EntityLiving {
if (CraftEventFactory.callEntityTransformEvent(this, t0, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) {
return null;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), t0.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return null; // Paper
this.world.addEntity(t0, CreatureSpawnEvent.SpawnReason.DROWNED);
// CraftBukkit end
this.die();
2018-07-30 05:54:13 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
2020-06-25 16:09:55 +02:00
index 48d7e0f971d3147218e3be774a75cdb10d8b55a6..23ef033067e388b7b7b2a981df8655e240a30594 100644
2018-07-30 05:54:13 +02:00
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
2020-06-25 16:09:55 +02:00
@@ -150,6 +150,7 @@ public class EntityMushroomCow extends EntityCow implements IShearable {
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
return;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return; // Paper
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
2018-07-30 05:54:13 +02:00
2020-06-25 16:09:55 +02:00
this.die(); // CraftBukkit - from above
2018-07-30 05:54:13 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
2020-06-25 16:09:55 +02:00
index 00183a7f6e2000ce045ce50454f1296c4c93b148..a23c8d54a30a1ed1a3ed4d158da08229f59ca4c5 100644
2018-07-30 05:54:13 +02:00
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
2020-06-25 16:09:55 +02:00
@@ -733,6 +733,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
return;
2018-07-30 05:54:13 +02:00
}
2020-06-25 16:09:55 +02:00
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper
this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
// CraftBukkit end
2018-07-30 05:54:13 +02:00
this.die();
2020-06-25 16:09:55 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 951cf5546af11434971a26dca15c20c25e6c555e..bb7f62fa52b758ed83db7def9053b79da3d97dcd 100644
2020-06-25 16:09:55 +02:00
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -399,6 +399,7 @@ public class EntityZombie extends EntityMonster {
if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
return;
2018-07-30 05:54:13 +02:00
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.INFECTED).callEvent()) return; // Paper
2019-05-01 00:51:03 +02:00
entityvillager.die(); // CraftBukkit - from above
2018-07-30 05:54:13 +02:00
this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
// CraftBukkit end
2018-07-30 05:54:13 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java
2020-06-25 16:09:55 +02:00
index 2fb6356940b57e112d1ef35bfd3aee9cd98e5754..9b920332bd397f9711f0c99702245d54b9d3841b 100644
2018-07-30 05:54:13 +02:00
--- a/src/main/java/net/minecraft/server/EntityZombieVillager.java
+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java
2020-06-25 16:09:55 +02:00
@@ -212,6 +212,7 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo
((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam
return;
2018-07-30 05:54:13 +02:00
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.CURED).callEvent()) return; // Paper
2019-05-01 00:51:03 +02:00
this.die(); // CraftBukkit - from above
worldserver.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason
// CraftBukkit end