Files
CatServer/patches/net/minecraft/item/ItemLilyPad.java.patch
2018-07-15 13:26:53 +08:00

18 lines
1.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java
+++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java
@@ -49,7 +49,14 @@
{
// special case for handling block placement with water lilies
net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1);
+ // Svarka start - special case for handling block placement with water lilies
+ org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(worldIn, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
worldIn.setBlockState(blockpos1, Blocks.WATERLILY.getDefaultState());
+ org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(worldIn, playerIn, hand, blockstate, blockpos.getX(), blockpos.getY(), blockpos.getZ());
+ if(placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())){
+ blockstate.update();
+ return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn);
+ }
if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP, hand).isCanceled())
{
blocksnapshot.restore(true, false);