Files
CatServer/patches/net/minecraft/block/BlockBush.java.patch
2018-09-08 17:51:33 +08:00

29 lines
1.0 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -2,6 +2,9 @@
import java.util.Random;
import javax.annotation.Nullable;
+
+import org.bukkit.event.block.BlockPhysicsEvent;
+
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@@ -62,6 +65,15 @@
{
if (!this.canBlockStay(worldIn, pos, state))
{
+ // CraftBukkit Start
+ org.bukkit.block.Block block = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
+ BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
+ worldIn.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);
}