Paper/Spigot-Server-Patches/0306-EntityTransformedEvent.patch
Aikar 459987d69f
More improvements to activation range, improve turtles
improved the water code so that immunity wont trigger if the entity
has the water pathfinder system active, so this improves support
for all entities that know how to behave in water.

Merged 2 EAR patches together, and removed an MCUtil method that
doesnt have a purpose anymore
2018-10-04 23:18:46 -04:00

70 Zeilen
4.6 KiB
Diff

From db6933607895a3d095e9699ebfa6ca114c43d273 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 5b856aea2f..13a6ddac59 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -43,7 +43,7 @@ public class EntityMushroomCow extends EntityCow {
if (this.hasCustomName()) {
entitycow.setCustomName(this.getCustomName());
}
-
+ 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);
for (int i = 0; i < 5; ++i) {
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index e37fca5b12..62bb51104d 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -623,7 +623,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
entitywitch.setCustomName(this.getCustomName());
entitywitch.setCustomNameVisible(this.getCustomNameVisible());
}
-
+ 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); // Paper - Added lightning spawn reason for this entity
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index e5170bff5b..04d25ad76a 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -234,7 +234,7 @@ public class EntityZombie extends EntityMonster {
entityzombie.setCustomName(this.getCustomName());
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
}
-
+ 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();
}
@@ -393,6 +393,7 @@ public class EntityZombie extends EntityMonster {
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
+ 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 bf136a6aa3..94bd3c5b37 100644
--- a/src/main/java/net/minecraft/server/EntityZombieVillager.java
+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java
@@ -130,7 +130,7 @@ public class EntityZombieVillager extends EntityZombie {
entityvillager.setCustomName(this.getCustomName());
entityvillager.setCustomNameVisible(this.getCustomNameVisible());
}
-
+ 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.19.0