summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityEnderman.patch
blob: 7ae2611f817aab46b84022092ba88d2d58002d0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- ../work/decompile-8eb82bde//net/minecraft/server/EntityEnderman.java	2014-11-28 17:43:43.085707435 +0000
+++ src/main/java/net/minecraft/server/EntityEnderman.java	2014-11-28 17:38:21.000000000 +0000
@@ -4,6 +4,12 @@
 import java.util.Set;
 import java.util.UUID;
 
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityTeleportEvent;
+// CraftBukkit end
+
 public class EntityEnderman extends EntityMonster {
 
     private static final UUID b = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
@@ -165,7 +171,17 @@
             }
 
             if (flag1) {
-                super.enderTeleportTo(this.locX, this.locY, this.locZ);
+                // CraftBukkit start - Teleport event
+                // super.enderTeleportTo(this.locX, this.locY, this.locZ);
+                EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ));
+                this.world.getServer().getPluginManager().callEvent(teleport);
+                if (teleport.isCancelled()) {
+                    return false;
+                }
+
+                Location to = teleport.getTo();
+                this.enderTeleportTo(to.getX(), to.getY(), to.getZ());
+                // CraftBukkit end
                 if (this.world.getCubes(this, this.getBoundingBox()).isEmpty() && !this.world.containsLiquid(this.getBoundingBox())) {
                     flag = true;
                 }