3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 15:20:11 +01:00
Paper/nms-patches/ItemBoat.patch

34 Zeilen
2.0 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ItemBoat.java
+++ b/net/minecraft/server/ItemBoat.java
2020-06-25 02:00:00 +02:00
@@ -41,6 +41,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
2019-04-23 04:00:00 +02:00
+ 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);
+
2016-02-29 22:32:46 +01:00
+ if (event.isCancelled()) {
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ // CraftBukkit end
2020-06-25 02:00:00 +02:00
EntityBoat entityboat = new EntityBoat(world, movingobjectpositionblock.getPos().x, movingobjectpositionblock.getPos().y, movingobjectpositionblock.getPos().z);
2019-04-23 04:00:00 +02:00
entityboat.setType(this.b);
2020-06-25 02:00:00 +02:00
@@ -49,7 +56,15 @@
2020-01-21 22:00:00 +01:00
return InteractionResultWrapper.fail(itemstack);
} else {
if (!world.isClientSide) {
- world.addEntity(entityboat);
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), entityhuman, entityboat).isCancelled()) {
2020-01-21 22:00:00 +01:00
+ return InteractionResultWrapper.fail(itemstack);
+ }
+
+ if (!world.addEntity(entityboat)) {
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ // CraftBukkit end
2019-12-10 23:00:00 +01:00
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
}