Commits
md_5 authored 75f99ec7c5c
5 5 | import javax.annotation.Nullable; |
6 6 | |
7 7 | +// CraftBukkit start |
8 8 | +import org.bukkit.event.entity.EntityInteractEvent; |
9 9 | +import org.bukkit.craftbukkit.event.CraftEventFactory; |
10 10 | +// CraftBukkit end |
11 11 | + |
12 12 | public class BlockSoil extends Block { |
13 13 | |
14 14 | public static final BlockStateInteger MOISTURE = BlockStateInteger.of("moisture", 0, 7); |
15 - | |
15 + | |
16 16 | if (i > 0) { |
17 17 | world.setTypeAndData(blockposition, iblockdata.set(BlockSoil.MOISTURE, Integer.valueOf(i - 1)), 2); |
18 18 | } else if (!this.b(world, blockposition)) { |
19 19 | + // CraftBukkit start |
20 20 | + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); |
21 21 | + if (CraftEventFactory.callBlockFadeEvent(block, Blocks.DIRT).isCancelled()) { |
22 22 | + return; |
23 23 | + } |
24 24 | + // CraftBukkit end |
25 25 | world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); |
26 26 | } |
27 27 | } else if (i < 7) { |
28 - | |
28 + | |
29 29 | } |
30 30 | |
31 31 | public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) { |
32 32 | + super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage. |
33 33 | if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean("mobGriefing")) && entity.width * entity.width * entity.length > 0.512F) { |
34 34 | + |
35 35 | + // CraftBukkit start - Interact soil |
36 36 | + org.bukkit.event.Cancellable cancellable; |
37 37 | + if (entity instanceof EntityHuman) { |
38 38 | + cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null); |