diff options
author | Mike Primm <mike@primmhome.com> | 2012-01-11 21:49:19 -0600 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2012-01-22 18:20:01 +0100 |
commit | 229337bc8ffe403001e339a0f83e0ae7b9f37393 (patch) | |
tree | 852896be92a7f8c87f4c06a6996b6b9c17453adc /src/main/java/net/minecraft/server/BlockFire.java | |
parent | 51b29eff0666aa56032db4471c388e1786303c60 (diff) | |
download | craftbukkit-229337bc8ffe403001e339a0f83e0ae7b9f37393.tar craftbukkit-229337bc8ffe403001e339a0f83e0ae7b9f37393.tar.gz craftbukkit-229337bc8ffe403001e339a0f83e0ae7b9f37393.tar.lz craftbukkit-229337bc8ffe403001e339a0f83e0ae7b9f37393.tar.xz craftbukkit-229337bc8ffe403001e339a0f83e0ae7b9f37393.zip |
Use BlockFadeEvents to signal fire blocks burning out
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockFire.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockFire.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index cd28dae4..3c5e1507 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -3,6 +3,7 @@ package net.minecraft.server; import java.util.Random; // CraftBukkit start +import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockBurnEvent; @@ -70,11 +71,11 @@ public class BlockFire extends Block { } if (!this.canPlace(world, i, j, k)) { - world.setTypeId(i, j, k, 0); + fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location } if (!flag && world.w() && (world.v(i, j, k) || world.v(i - 1, j, k) || world.v(i + 1, j, k) || world.v(i, j, k - 1) || world.v(i, j, k + 1))) { - world.setTypeId(i, j, k, 0); + fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain } else { int l = world.getData(i, j, k); @@ -85,10 +86,10 @@ public class BlockFire extends Block { world.c(i, j, k, this.id, this.d()); if (!flag && !this.g(world, i, j, k)) { if (!world.e(i, j - 1, k) || l > 3) { - world.setTypeId(i, j, k, 0); + fireExtinguished(world, i, j, k); // CraftBukkit - burn out } } else if (!flag && !this.b(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) { - world.setTypeId(i, j, k, 0); + fireExtinguished(world, i, j, k); // CraftBukkit - burn out } else { this.a(world, i + 1, j, k, 300, random, l); this.a(world, i - 1, j, k, 300, random, l); @@ -234,17 +235,24 @@ public class BlockFire extends Block { public void doPhysics(World world, int i, int j, int k, int l) { if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) { - world.setTypeId(i, j, k, 0); + fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone } } public void onPlace(World world, int i, int j, int k) { if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) { if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) { - world.setTypeId(i, j, k, 0); + fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke } else { world.c(i, j, k, this.id, this.d()); } } } + // CraftBukkit start + private void fireExtinguished(World world, int x, int y, int z) { + if (CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled() == false) { + world.setTypeId(x, y, z, 0); + } + } + // CraftBukkit end } |