3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/nms-patches/EntityShulker.patch

48 Zeilen
2.3 KiB
Diff

--- a/net/minecraft/server/EntityShulker.java
+++ b/net/minecraft/server/EntityShulker.java
2019-04-23 04:00:00 +02:00
@@ -6,6 +6,10 @@
2018-12-25 22:00:00 +01:00
import java.util.Optional;
import java.util.UUID;
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 {
2020-06-25 02:00:00 +02:00
@@ -31,7 +35,7 @@
2019-04-23 04:00:00 +02:00
this.goalSelector.a(4, new EntityShulker.a());
this.goalSelector.a(7, new EntityShulker.e());
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error
this.targetSelector.a(2, new EntityShulker.d(this));
this.targetSelector.a(3, new EntityShulker.c(this));
}
2020-06-25 02:00:00 +02:00
@@ -279,6 +283,16 @@
EnumDirection enumdirection = this.g(blockposition1);
2020-06-25 02:00:00 +02:00
if (enumdirection != null) {
+ // 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());
+ } else {
+ return false;
+ }
+ // CraftBukkit end
this.datawatcher.set(EntityShulker.b, enumdirection);
this.playSound(SoundEffects.ENTITY_SHULKER_TELEPORT, 1.0F, 1.0F);
this.datawatcher.set(EntityShulker.c, Optional.of(blockposition1));
@@ -319,6 +333,7 @@
2019-12-10 23:00:00 +01:00
}
this.f((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
2019-04-23 04:00:00 +02:00
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
2019-12-10 23:00:00 +01:00
}
}