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
|
--- a/net/minecraft/world/entity/monster/Shulker.java
+++ b/net/minecraft/world/entity/monster/Shulker.java
@@ -59,7 +59,11 @@
import net.minecraft.world.phys.Vec3;
import org.joml.Vector3f;
-public class Shulker extends AbstractGolem implements VariantHolder<Optional<DyeColor>>, Enemy {
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.entity.EntityTeleportEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
private static final AttributeModifier COVERED_ARMOR_MODIFIER = new AttributeModifier(Shulker.COVERED_ARMOR_MODIFIER_UUID, "Covered armor bonus", 20.0D, AttributeModifier.Operation.ADDITION);
@@ -419,7 +405,15 @@
if (blockpos1.getY() > this.level().getMinBuildHeight() && this.level().isEmptyBlock(blockpos1) && this.level().getWorldBorder().isWithinBounds(blockpos1) && this.level().noCollision(this, (new AABB(blockpos1)).deflate(1.0E-6D))) {
Direction direction = this.findAttachableSurface(blockpos1);
- if (direction != null) {
+ 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(direction);
this.playSound(SoundEvents.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -489,10 +481,10 @@
if (this.level().random.nextFloat() >= f) {
Shulker shulker = (Shulker) EntityType.SHULKER.create(this.level());
- if (shulker != null) {
- shulker.setVariant(this.getVariant());
- shulker.moveTo(vec3);
- this.level().addFreshEntity(shulker);
+ if (entityshulker != null) {
+ entityshulker.setVariant(this.getVariant());
+ entityshulker.moveTo(vec3d);
+ this.level().addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
}
}
|