Files
2019-02-24 22:29:41 +08:00

26 lines
1.4 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemBoat.java
+++ ../src-work/minecraft/net/minecraft/item/ItemBoat.java
@@ -84,6 +84,11 @@
}
else
{
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(playerIn, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, raytraceresult.getBlockPos(), raytraceresult.sideHit, itemstack, handIn);
+
+ if (event.isCancelled()) {
+ return new ActionResult<>(EnumActionResult.PASS, itemstack);
+ }
Block block = worldIn.getBlockState(raytraceresult.getBlockPos()).getBlock();
boolean flag1 = block == Blocks.WATER || block == Blocks.FLOWING_WATER;
EntityBoat entityboat = new EntityBoat(worldIn, raytraceresult.hitVec.x, flag1 ? raytraceresult.hitVec.y - 0.12D : raytraceresult.hitVec.y, raytraceresult.hitVec.z);
@@ -98,7 +103,9 @@
{
if (!worldIn.isRemote)
{
- worldIn.spawnEntity(entityboat);
+ // worldIn.spawnEntity(entityboat);
+ if (!worldIn.spawnEntity(entityboat))
+ return new ActionResult<>(EnumActionResult.PASS, itemstack);
}
if (!playerIn.capabilities.isCreativeMode)