summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityShulker.patch
blob: 450f5b4611cff32719857a5367de68224dc50511 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- a/net/minecraft/server/EntityShulker.java
+++ b/net/minecraft/server/EntityShulker.java
@@ -6,6 +6,10 @@
 import java.util.UUID;
 import java.util.function.Predicate;
 import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.event.entity.EntityTeleportEvent;
+// CraftBukkit end
 
 public class EntityShulker extends EntityGolem implements IMonster {
 
@@ -44,7 +48,7 @@
     protected void n() {
         this.goalSelector.a(1, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
         this.goalSelector.a(4, new EntityShulker.a());
-        this.goalSelector.a(7, new EntityShulker.e(null));
+        this.goalSelector.a(7, new EntityShulker.e()); // CraftBukkit - decompile error
         this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
         this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0]));
         this.targetSelector.a(2, new EntityShulker.d(this));
@@ -321,8 +325,17 @@
                         EnumDirection enumdirection = aenumdirection[k];
 
                         if (this.world.q(blockposition1.shift(enumdirection))) {
-                            this.datawatcher.set(EntityShulker.a, enumdirection);
-                            flag = true;
+                            // CraftBukkit start
+                            EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), new Location(this.world.getWorld(), blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
+                            this.world.getServer().getPluginManager().callEvent(teleport);
+                            if (!teleport.isCancelled()) {
+                                Location to = teleport.getTo();
+                                blockposition1 = new BlockPosition(to.getX(), to.getY(), to.getZ());
+
+                                this.datawatcher.set(EntityShulker.a, enumdirection);
+                                flag = true;
+                            }
+                            // CraftBukkit end
                             break;
                         }
                     }
@@ -367,6 +380,7 @@
                 this.locX = (double) blockposition.getX() + 0.5D;
                 this.locY = (double) blockposition.getY();
                 this.locZ = (double) blockposition.getZ() + 0.5D;
+                if (valid) world.entityJoinedWorld(this, false); // CraftBukkit
                 this.lastX = this.locX;
                 this.lastY = this.locY;
                 this.lastZ = this.locZ;