Paper/nms-patches/EntityShulker.patch

42 Zeilen
2.0 KiB
Diff

--- a/net/minecraft/server/EntityShulker.java
+++ b/net/minecraft/server/EntityShulker.java
@@ -6,6 +6,10 @@
import java.util.UUID;
2018-07-15 02:00:00 +02:00
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 {
2018-12-06 00:00:00 +01:00
@@ -321,8 +325,17 @@
EnumDirection enumdirection = aenumdirection[k];
2018-07-15 02:00:00 +02:00
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;
}
}
2018-12-06 00:00:00 +01:00
@@ -367,6 +380,7 @@
2018-09-26 09:19:16 +02:00
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;