diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2012-01-14 12:56:54 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2012-01-14 12:56:54 +0000 |
commit | 9da730c8e1b33b242a02e631d6433bca3d2fb8e7 (patch) | |
tree | 3b5a325903788fd96fc967f953abae62885eda44 | |
parent | 64ac337d4c1d532d55832dd801d525eff15fd674 (diff) | |
download | craftbukkit-9da730c8e1b33b242a02e631d6433bca3d2fb8e7.tar craftbukkit-9da730c8e1b33b242a02e631d6433bca3d2fb8e7.tar.gz craftbukkit-9da730c8e1b33b242a02e631d6433bca3d2fb8e7.tar.lz craftbukkit-9da730c8e1b33b242a02e631d6433bca3d2fb8e7.tar.xz craftbukkit-9da730c8e1b33b242a02e631d6433bca3d2fb8e7.zip |
Made Mycel blocks throw BlockFade and BlockSpread events. This fixes BUKKIT-488. Thanks to tips48 for the pull request.
-rw-r--r-- | src/main/java/net/minecraft/server/BlockMycel.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java index f107db77..dd7acbbd 100644 --- a/src/main/java/net/minecraft/server/BlockMycel.java +++ b/src/main/java/net/minecraft/server/BlockMycel.java @@ -1,6 +1,8 @@ package net.minecraft.server; import java.util.Random; +import org.bukkit.event.block.BlockFadeEvent; // CraftBukkit +import org.bukkit.event.block.BlockSpreadEvent; // CraftBukkit public class BlockMycel extends Block { @@ -17,7 +19,18 @@ public class BlockMycel extends Block { public void a(World world, int i, int j, int k, Random random) { if (!world.isStatic) { if (world.getLightLevel(i, j + 1, k) < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) { - world.setTypeId(i, j, k, Block.DIRT.id); + // CraftBukkit start + org.bukkit.World bworld = world.getWorld(); + org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState(); + blockState.setTypeId(Block.DIRT.id); + + BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState); + world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + blockState.update(true); + } + // CraftBukkit end } else if (world.getLightLevel(i, j + 1, k) >= 9) { for (int l = 0; l < 4; ++l) { int i1 = i + random.nextInt(3) - 1; @@ -26,7 +39,18 @@ public class BlockMycel extends Block { int l1 = world.getTypeId(i1, j1 + 1, k1); if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.q[l1] <= 2) { - world.setTypeId(i1, j1, k1, this.id); + // CraftBukkit start + org.bukkit.World bworld = world.getWorld(); + org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState(); + blockState.setTypeId(this.id); + + BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState); + world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + blockState.update(true); + } + // CraftBukkit end } } } |