diff options
author | EvilSeph <evilseph@gmail.com> | 2011-07-14 23:15:09 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-07-14 23:26:01 -0400 |
commit | 0bd535e054b50ede75da54e55f1c1c5487604a4f (patch) | |
tree | c2c8ed8b2a2a03133046713498206b7c922408ca /src/main/java/net | |
parent | 30a382a6dc20299b2a36c8bf4079a95e39a54366 (diff) | |
download | craftbukkit-0bd535e054b50ede75da54e55f1c1c5487604a4f.tar craftbukkit-0bd535e054b50ede75da54e55f1c1c5487604a4f.tar.gz craftbukkit-0bd535e054b50ede75da54e55f1c1c5487604a4f.tar.lz craftbukkit-0bd535e054b50ede75da54e55f1c1c5487604a4f.tar.xz craftbukkit-0bd535e054b50ede75da54e55f1c1c5487604a4f.zip |
Made fire spread trigger BlockSpreadEvent. Thanks N3X15!
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockFire.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index 9b14a901..35e43955 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -6,6 +6,8 @@ import java.util.Random; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.material.MaterialData; // CraftBukkit end public class BlockFire extends Block { @@ -91,7 +93,8 @@ public class BlockFire extends Block { org.bukkit.World bworld = world.getWorld(); IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD; - // CraftBukkit + org.bukkit.block.Block fromBlock = bworld.getBlockAt(i, j, k); + // CraftBukkit end for (int i1 = i - 1; i1 <= i + 1; ++i1) { for (int j1 = k - 1; j1 <= k + 1; ++j1) { @@ -125,7 +128,16 @@ public class BlockFire extends Block { continue; } - world.setTypeIdAndData(i1, k1, j1, this.id, k2); + org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState(); + blockState.setTypeId(this.id); + blockState.setData(new MaterialData(this.id, (byte) k2)); + + BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), fromBlock, blockState); + server.getPluginManager().callEvent(spreadEvent); + + if (!spreadEvent.isCancelled()) { + blockState.update(true); + } } // CraftBukkit end } |