summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockStationary.java
diff options
context:
space:
mode:
authorspeakeasy <mekevin1917@gmail.com>2011-01-11 05:07:56 +0800
committertahg <tahgtahv@gmail.com>2011-01-11 05:25:09 +0800
commit802a46a7097354fe40a6502edc5357e105e84fc3 (patch)
treee529ea463ec0f9f48d42b45189d26d41b25524a4 /src/main/java/net/minecraft/server/BlockStationary.java
parent136ad76e6ac7316825cbbd2b19fc03a67a20f5b9 (diff)
downloadcraftbukkit-802a46a7097354fe40a6502edc5357e105e84fc3.tar
craftbukkit-802a46a7097354fe40a6502edc5357e105e84fc3.tar.gz
craftbukkit-802a46a7097354fe40a6502edc5357e105e84fc3.tar.lz
craftbukkit-802a46a7097354fe40a6502edc5357e105e84fc3.tar.xz
craftbukkit-802a46a7097354fe40a6502edc5357e105e84fc3.zip
Added hooks for BlockIgniteEvent
Signed-off-by: speakeasy <mekevin1917@gmail.com>
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockStationary.java')
-rw-r--r--src/main/java/net/minecraft/server/BlockStationary.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java
new file mode 100644
index 00000000..452449aa
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockStationary.java
@@ -0,0 +1,72 @@
+package net.minecraft.server;
+
+import org.bukkit.event.block.BlockIgniteEvent;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.CraftWorld;
+import java.util.Random;
+
+public class BlockStationary extends BlockFluids {
+
+ protected BlockStationary(int k, Material material) {
+ super(k, material);
+ a(false);
+ if (material == Material.g) {
+ a(true);
+ }
+ }
+
+ public void b(World world, int k, int l, int i1, int j1) {
+ super.b(world, k, l, i1, j1);
+ if (world.a(k, l, i1) == bh) {
+ i(world, k, l, i1);
+ }
+ }
+
+ private void i(World world, int k, int l, int i1) {
+ int j1 = world.b(k, l, i1);
+
+ world.i = true;
+ world.a(k, l, i1, bh - 1, j1);
+ world.b(k, l, i1, k, l, i1);
+ world.h(k, l, i1, bh - 1);
+ world.i = false;
+ }
+
+ @Override
+ public void a(World world, int k, int l, int i1, Random random) {
+ if (bs == Material.g) {
+ int j1 = random.nextInt(3);
+ // CraftBukkit: prevent lava putting something on fire.
+ CraftServer server = ((WorldServer)world).getServer();
+ CraftWorld cworld = ((WorldServer)world).getWorld();
+ org.bukkit.Block bblock = (cworld.getBlockAt(k, l, i1));
+ BlockIgniteEvent event = new BlockIgniteEvent((org.bukkit.Block) bblock, BlockIgniteEvent.IgniteCause.LAVA, null);
+ server.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ ;
+ } else {
+ for (int k1 = 0; k1 < j1; k1++) {
+ k += random.nextInt(3) - 1;
+ l++;
+ i1 += random.nextInt(3) - 1;
+ int l1 = world.a(k, l, i1);
+
+ if (l1 == 0) {
+ if (j(world, k - 1, l, i1) || j(world, k + 1, l, i1) || j(world, k, l, i1 - 1) || j(world, k, l, i1 + 1) || j(world, k, l - 1, i1) || j(world, k, l + 1, i1)) {
+ world.d(k, l, i1, Block.ar.bh);
+ return;
+ }
+ continue;
+ }
+ if (Block.m[l1].bs.c()) {
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ private boolean j(World world, int k, int l, int i1) {
+ return world.c(k, l, i1).e();
+ }
+}