PaperMC/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityShulker.patch
CraftBukkit/Spigot eed041d629 Update to Minecraft 1.21
By: md_5 <git@md-5.net>
2024-06-14 01:05:00 +10:00

39 lines
1.9 KiB
Diff

--- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -58,6 +58,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.entity.EntityTeleportEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
private static final MinecraftKey COVERED_ARMOR_MODIFIER_ID = MinecraftKey.withDefaultNamespace("covered");
@@ -401,6 +407,14 @@
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) {
+ // CraftBukkit start
+ EntityTeleportEvent teleportEvent = CraftEventFactory.callEntityTeleportEvent(this, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ());
+ if (teleportEvent.isCancelled()) {
+ return false;
+ } else {
+ blockposition1 = CraftLocation.toBlockPosition(teleportEvent.getTo());
+ }
+ // CraftBukkit end
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -471,7 +485,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
}
}