2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemBoat.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemBoat.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -56,6 +56,13 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
2016-02-29 22:32:46 +01:00
|
|
|
+ // CraftBukkit start - Boat placement
|
2021-11-21 23:00:00 +01: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, enumhand);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2016-02-29 22:32:46 +01:00
|
|
|
+ if (event.isCancelled()) {
|
2021-03-15 23:00:00 +01:00
|
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
2016-02-29 22:32:46 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
EntityBoat entityboat = new EntityBoat(world, movingobjectpositionblock.getLocation().x, movingobjectpositionblock.getLocation().y, movingobjectpositionblock.getLocation().z);
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
entityboat.setType(this.type);
|
|
|
|
@@ -64,7 +71,15 @@
|
2020-01-21 22:00:00 +01:00
|
|
|
return InteractionResultWrapper.fail(itemstack);
|
2017-03-21 23:03:20 +01:00
|
|
|
} else {
|
|
|
|
if (!world.isClientSide) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- world.addFreshEntity(entityboat);
|
2019-12-19 02:53:27 +01:00
|
|
|
+ // CraftBukkit start
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, entityboat).isCancelled()) {
|
2020-01-21 22:00:00 +01:00
|
|
|
+ return InteractionResultWrapper.fail(itemstack);
|
2019-12-19 02:53:27 +01:00
|
|
|
+ }
|
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (!world.addFreshEntity(entityboat)) {
|
2021-03-15 23:00:00 +01:00
|
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
2019-12-19 02:53:27 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
world.gameEvent(entityhuman, GameEvent.ENTITY_PLACE, new BlockPosition(movingobjectpositionblock.getLocation()));
|
2021-06-11 07:00:00 +02:00
|
|
|
if (!entityhuman.getAbilities().instabuild) {
|
2021-11-21 23:00:00 +01:00
|
|
|
itemstack.shrink(1);
|