Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
26 Zeilen
1.6 KiB
Diff
26 Zeilen
1.6 KiB
Diff
--- a/net/minecraft/server/ItemBoat.java
|
|
+++ b/net/minecraft/server/ItemBoat.java
|
|
@@ -52,6 +52,13 @@
|
|
if (flag) {
|
|
return new InteractionResultWrapper<>(EnumInteractionResult.PASS, itemstack);
|
|
} else if (movingobjectposition.type == 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, movingobjectposition.getBlockPosition(), movingobjectposition.direction, itemstack, enumhand);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
BlockPosition blockposition = movingobjectposition.getBlockPosition();
|
|
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) {
|