Paper/Spigot-Server-Patches/0264-EntityTransformedEvent.patch
Shane Freeder 93891ad57a
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
3d9d2efc SPIGOT-5202: WorldCreator#copy does not copy all options

CraftBukkit Changes:
3e7b3862 SPIGOT-5195 (#2): Player loot table does not drop when keepInventory is on
c88867e4 SPIGOT-5208: Reset state on cancelled EntityTransformEvent to prevent event spam
f744c09c SPIGOT-5214: setCooldown not working
860b3540 SPIGOT-5204: Typo in deprecated enchantment name
2019-07-28 15:32:14 +01:00

66 lines
4.7 KiB
Diff

From 5372197b746a06b86ed5a30e0cc24f048a583a99 Mon Sep 17 00:00:00 2001
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
index 3b1b0b599..1363069ff 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -110,6 +110,7 @@ public class EntityMushroomCow extends EntityCow {
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
return false;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return false; // Paper
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
this.die(); // CraftBukkit - from above
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index a4033a666..c2ccb8589 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -711,6 +711,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
return;
}
+ 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
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index a3af14630..832375f27 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -252,6 +252,7 @@ public class EntityZombie extends EntityMonster {
return;
}
// CraftBukkit end
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityzombie.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return; // Paper
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.DROWNED); // CraftBukkit - added spawn reason
this.die();
}
@@ -424,6 +425,7 @@ public class EntityZombie extends EntityMonster {
if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
return;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.INFECTED).callEvent()) return; // Paper
entityvillager.die(); // CraftBukkit - from above
this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java
index edb0aa220..d2bd3bb31 100644
--- a/src/main/java/net/minecraft/server/EntityZombieVillager.java
+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java
@@ -172,6 +172,7 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo
((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam
return;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.CURED).callEvent()) return; // Paper
this.die(); // CraftBukkit - from above
worldserver.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason
// CraftBukkit end
--
2.22.0