Paper/nms-patches/ItemBoat.patch

26 lines
1.6 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ItemBoat.java
+++ b/net/minecraft/server/ItemBoat.java
2018-07-15 02:00:00 +02:00
@@ -52,6 +52,13 @@
if (flag) {
2016-02-29 22:32:46 +01:00
return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
2018-07-15 02:00:00 +02:00
} else if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
2016-02-29 22:32:46 +01:00
+ // CraftBukkit start - Boat placement
2018-12-06 00: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, movingobjectposition.getBlockPosition(), movingobjectposition.direction, itemstack, enumhand);
+
2016-02-29 22:32:46 +01:00
+ if (event.isCancelled()) {
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ // CraftBukkit end
2018-12-06 00:00:00 +01:00
BlockPosition blockposition = movingobjectposition.getBlockPosition();
2018-07-15 02:00:00 +02:00
Block block = world.getType(blockposition).getBlock();
EntityBoat entityboat = new EntityBoat(world, movingobjectposition.pos.x, movingobjectposition.pos.y, movingobjectposition.pos.z);
@@ -62,7 +69,7 @@
return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
} else {
if (!world.isClientSide) {
- world.addEntity(entityboat);
+ if (!world.addEntity(entityboat)) return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); // CraftBukkit
}
if (!entityhuman.abilities.canInstantlyBuild) {