mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 18:50:51 +01:00
30e4583dbe
By: Initial Source <noreply+automated@papermc.io>
33 lines
1.9 KiB
Diff
33 lines
1.9 KiB
Diff
--- a/net/minecraft/world/item/BoatItem.java
|
|
+++ b/net/minecraft/world/item/BoatItem.java
|
|
@@ -58,6 +58,13 @@
|
|
}
|
|
|
|
if (movingobjectpositionblock.getType() == HitResult.Type.BLOCK) {
|
|
+ // CraftBukkit start - Boat placement
|
|
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(user, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, false, hand, movingobjectpositionblock.getLocation());
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return InteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
AbstractBoat abstractboat = this.getBoat(world, movingobjectpositionblock, itemstack, user);
|
|
|
|
if (abstractboat == null) {
|
|
@@ -68,7 +75,15 @@
|
|
return InteractionResult.FAIL;
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
- world.addFreshEntity(abstractboat);
|
|
+ // CraftBukkit start
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), user, abstractboat, hand).isCancelled()) {
|
|
+ return InteractionResult.FAIL;
|
|
+ }
|
|
+
|
|
+ if (!world.addFreshEntity(abstractboat)) {
|
|
+ return InteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.gameEvent((Entity) user, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
|
itemstack.consume(1, user);
|
|
}
|