13
0
geforkt von Mirrors/Paper
Paper/paper-server/nms-patches/net/minecraft/world/item/ItemBoat.patch

34 Zeilen
2.0 KiB
Diff

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/world/item/ItemBoat.java
+++ b/net/minecraft/world/item/ItemBoat.java
@@ -56,6 +56,13 @@
}
if (movingobjectpositionblock.getType() == 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, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), itemstack, enumhand);
+
+ if (event.isCancelled()) {
2021-03-15 23:00:00 +01:00
+ return InteractionResultWrapper.pass(itemstack);
+ }
+ // CraftBukkit end
EntityBoat entityboat = new EntityBoat(world, movingobjectpositionblock.getPos().x, movingobjectpositionblock.getPos().y, movingobjectpositionblock.getPos().z);
entityboat.setType(this.type);
@@ -64,7 +71,15 @@
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()) {
+ return InteractionResultWrapper.fail(itemstack);
+ }
+
+ if (!world.addEntity(entityboat)) {
2021-03-15 23:00:00 +01:00
+ return InteractionResultWrapper.pass(itemstack);
+ }
+ // CraftBukkit end
world.a((Entity) entityhuman, GameEvent.ENTITY_PLACE, new BlockPosition(movingobjectpositionblock.getPos()));
if (!entityhuman.getAbilities().instabuild) {
itemstack.subtract(1);