mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 03:05:39 +01:00
33 lines
2 KiB
Diff
33 lines
2 KiB
Diff
--- a/net/minecraft/server/ItemBoat.java
|
|
+++ b/net/minecraft/server/ItemBoat.java
|
|
@@ -41,6 +41,13 @@
|
|
}
|
|
|
|
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
|
+ // CraftBukkit start - Boat placement
|
|
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), itemstack, enumhand);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
EntityBoat entityboat = new EntityBoat(world, movingobjectpositionblock.getPos().x, movingobjectpositionblock.getPos().y, movingobjectpositionblock.getPos().z);
|
|
|
|
entityboat.setType(this.b);
|
|
@@ -49,7 +56,15 @@
|
|
return InteractionResultWrapper.fail(itemstack);
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
- world.addEntity(entityboat);
|
|
+ // CraftBukkit start
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), entityhuman, entityboat).isCancelled()) {
|
|
+ return InteractionResultWrapper.fail(itemstack);
|
|
+ }
|
|
+
|
|
+ if (!world.addEntity(entityboat)) {
|
|
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
|
itemstack.subtract(1);
|
|
}
|