mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
20acc420d8
By: Jishuna <joshl5324@gmail.com>
33 lines
2 KiB
Diff
33 lines
2 KiB
Diff
--- a/net/minecraft/world/item/ItemBoat.java
|
|
+++ b/net/minecraft/world/item/ItemBoat.java
|
|
@@ -58,6 +58,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.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, false, enumhand, movingobjectpositionblock.getLocation());
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
EntityBoat entityboat = this.getBoat(world, movingobjectpositionblock);
|
|
|
|
entityboat.setVariant(this.type);
|
|
@@ -66,7 +73,15 @@
|
|
return InteractionResultWrapper.fail(itemstack);
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
- world.addFreshEntity(entityboat);
|
|
+ // CraftBukkit start
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, entityboat, enumhand).isCancelled()) {
|
|
+ return InteractionResultWrapper.fail(itemstack);
|
|
+ }
|
|
+
|
|
+ if (!world.addFreshEntity(entityboat)) {
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.gameEvent((Entity) entityhuman, GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
|
if (!entityhuman.getAbilities().instabuild) {
|
|
itemstack.shrink(1);
|