2021-03-16 09:00:00 +11:00
|
|
|
--- a/net/minecraft/world/item/ItemBoat.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemBoat.java
|
2024-10-23 02:15:00 +11:00
|
|
|
@@ -58,6 +58,13 @@
|
2019-04-23 12:00:00 +10:00
|
|
|
}
|
|
|
|
|
2020-06-25 10:00:00 +10:00
|
|
|
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
2016-03-01 08:32:46 +11:00
|
|
|
+ // CraftBukkit start - Boat placement
|
2023-06-17 14:31:40 +10:00
|
|
|
+ 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());
|
2014-11-26 08:32:16 +11:00
|
|
|
+
|
2016-03-01 08:32:46 +11:00
|
|
|
+ if (event.isCancelled()) {
|
2024-10-23 02:15:00 +11:00
|
|
|
+ return EnumInteractionResult.PASS;
|
2016-03-01 08:32:46 +11:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2024-10-23 02:15:00 +11:00
|
|
|
AbstractBoat abstractboat = this.getBoat(world, movingobjectpositionblock, itemstack, entityhuman);
|
2019-04-23 12:00:00 +10:00
|
|
|
|
2024-10-23 02:15:00 +11:00
|
|
|
if (abstractboat == null) {
|
|
|
|
@@ -68,7 +75,15 @@
|
|
|
|
return EnumInteractionResult.FAIL;
|
|
|
|
} else {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
- world.addFreshEntity(abstractboat);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, abstractboat, enumhand).isCancelled()) {
|
|
|
|
+ return EnumInteractionResult.FAIL;
|
|
|
|
+ }
|
2019-12-19 12:53:27 +11:00
|
|
|
+
|
2024-10-23 02:15:00 +11:00
|
|
|
+ if (!world.addFreshEntity(abstractboat)) {
|
|
|
|
+ return EnumInteractionResult.PASS;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
|
|
|
itemstack.consume(1, entityhuman);
|
|
|
|
}
|