3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/Spigot-Server-Patches/0264-EntityTransformedEvent.patch

66 Zeilen
4.7 KiB
Diff

2019-07-20 06:01:24 +02:00
From b9384d31cb672ba39234f47c4840290d8e72304c 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
2019-07-20 06:01:24 +02:00
index 3b1b0b5992..1363069ff2 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
@@ -110,6 +110,7 @@ public class EntityMushroomCow extends EntityCow {
2019-05-01 00:51:03 +02:00
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);
2018-07-30 05:54:13 +02:00
2019-05-01 00:51:03 +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
2019-07-20 06:01:24 +02:00
index a4033a6663..c2ccb85896 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
2019-07-20 06:01:24 +02:00
@@ -711,6 +711,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
2019-05-01 00:51:03 +02:00
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();
2018-07-30 05:54:13 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
2019-07-20 06:01:24 +02:00
index 99e501cef4..3542c17e9a 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
2019-07-20 06:01:24 +02:00
@@ -250,6 +250,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();
}
2019-07-20 06:01:24 +02:00
@@ -422,6 +423,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
2019-07-20 06:01:24 +02:00
index 3609946389..da8a8c8551 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
2019-07-20 06:01:24 +02:00
@@ -170,6 +170,7 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo
if (CraftEventFactory.callEntityTransformEvent(this, entityvillager, EntityTransformEvent.TransformReason.CURED).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.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
2018-07-30 05:54:13 +02:00
--
2.22.0
2018-07-30 05:54:13 +02:00