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

66 lines
4.5 KiB
Diff
Raw Normal View History

From 5b600d2b9415bea339241a122bbf8ab97ce2c103 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
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index 709dfb07..8ba9f3bb 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
@@ -53,6 +53,7 @@ public class EntityMushroomCow extends EntityCow {
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
return false;
2018-07-30 05:54:13 +02: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
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
// CraftBukkit end
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
index 78a549b0..868d2483 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
@@ -630,6 +630,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
return;
2018-07-30 05:54:13 +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();
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 02bebf72..4b326bf6 100644
2018-07-30 05:54:13 +02:00
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -247,6 +247,7 @@ public class EntityZombie extends EntityMonster {
return;
2018-07-30 05:54:13 +02:00
}
// CraftBukkit end
2018-07-30 05:54:13 +02:00
+ 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
2018-07-30 05:54:13 +02:00
this.die();
}
@@ -410,6 +411,7 @@ public class EntityZombie extends EntityMonster {
return;
2018-07-30 05:54:13 +02:00
}
// CraftBukkit end
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
this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java
index cbbd2197..0e5dd111 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
@@ -140,6 +140,7 @@ public class EntityZombieVillager extends EntityZombie {
return;
2018-07-30 05:54:13 +02:00
}
// CraftBukkit end
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
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);
--
2.17.1
2018-07-30 05:54:13 +02:00