3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 23:00:08 +01:00
Paper/nms-patches/ItemBoat.patch
2019-04-23 12:00:00 +10:00

27 Zeilen
1.6 KiB
Diff

--- a/net/minecraft/server/ItemBoat.java
+++ b/net/minecraft/server/ItemBoat.java
@@ -41,6 +41,14 @@
}
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
+ // CraftBukkit start - Boat placement
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), itemstack, enumhand);
+
+ if (event.isCancelled()) {
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ // CraftBukkit end
EntityBoat entityboat = new EntityBoat(world, movingobjectposition.getPos().x, movingobjectposition.getPos().y, movingobjectposition.getPos().z);
entityboat.setType(this.b);
@@ -49,7 +57,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) {