geforkt von Mirrors/Paper
d3a23f42c3
By: md_5 <git@md-5.net>
34 Zeilen
2.0 KiB
Diff
34 Zeilen
2.0 KiB
Diff
--- a/net/minecraft/world/item/ItemBoat.java
|
|
+++ b/net/minecraft/world/item/ItemBoat.java
|
|
@@ -58,6 +58,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.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, false, enumhand, movingobjectpositionblock.getLocation());
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
AbstractBoat abstractboat = this.getBoat(world, movingobjectpositionblock, itemstack, entityhuman);
|
|
|
|
if (abstractboat == null) {
|
|
@@ -68,7 +75,15 @@
|
|
return EnumInteractionResult.FAIL;
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
- world.addFreshEntity(abstractboat);
|
|
+ // CraftBukkit start
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, abstractboat, enumhand).isCancelled()) {
|
|
+ return EnumInteractionResult.FAIL;
|
|
+ }
|
|
+
|
|
+ if (!world.addFreshEntity(abstractboat)) {
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
|
itemstack.consume(1, entityhuman);
|
|
}
|