SPIGOT-794: Add boats to EntityPlaceEvent

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-12-19 12:53:27 +11:00
parent 9a1557b65f
commit 68fb3c06e5
2 changed files with 17 additions and 5 deletions

View File

@@ -15,12 +15,20 @@
EntityBoat entityboat = new EntityBoat(world, movingobjectposition.getPos().x, movingobjectposition.getPos().y, movingobjectposition.getPos().z);
entityboat.setType(this.b);
@@ -49,7 +57,7 @@
@@ -49,7 +57,15 @@
return InteractionResultWrapper.d(itemstack);
} else {
if (!world.isClientSide) {
- world.addEntity(entityboat);
+ if (!world.addEntity(entityboat)) return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); // CraftBukkit
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), entityhuman, entityboat).isCancelled()) {
+ return InteractionResultWrapper.d(itemstack);
+ }
+
+ if (!world.addEntity(entityboat)) {
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ // CraftBukkit end
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
}