PaperMC/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityShulker.patch

42 lines
2.1 KiB
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -60,6 +60,12 @@
2021-03-15 23:00:00 +01:00
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.entity.EntityTeleportEvent;
+// CraftBukkit end
+
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
@@ -408,6 +414,16 @@
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) {
+ // CraftBukkit start
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), CraftLocation.toBukkit(blockposition1, this.level.getWorld()));
+ this.level.getCraftServer().getPluginManager().callEvent(teleport);
+ if (!teleport.isCancelled()) {
+ Location to = teleport.getTo();
+ blockposition1 = BlockPosition.containing(to.getX(), to.getY(), to.getZ());
+ } else {
+ return false;
+ }
+ // CraftBukkit end
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -478,7 +494,7 @@
if (entityshulker != null) {
entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d);
- this.level.addFreshEntity(entityshulker);
+ this.level.addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
}
}