Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 77 lines 2.7 kB view raw
1package net.minecraft.server; 2 3import org.bukkit.event.block.BlockIgniteEvent; 4 5import java.util.Random; 6 7public class BlockStationary extends BlockFluids { 8 9 protected BlockStationary(int i, Material material) { 10 super(i, material); 11 this.a(false); 12 if (material == Material.LAVA) { 13 this.a(true); 14 } 15 } 16 17 public void doPhysics(World world, int i, int j, int k, int l) { 18 super.doPhysics(world, i, j, k, l); 19 if (world.getTypeId(i, j, k) == this.id) { 20 this.i(world, i, j, k); 21 } 22 } 23 24 private void i(World world, int i, int j, int k) { 25 int l = world.getData(i, j, k); 26 27 world.suppressPhysics = true; 28 world.setRawTypeIdAndData(i, j, k, this.id - 1, l); 29 world.b(i, j, k, i, j, k); 30 world.c(i, j, k, this.id - 1, this.c()); 31 world.suppressPhysics = false; 32 } 33 34 public void a(World world, int i, int j, int k, Random random) { 35 if (this.material == Material.LAVA) { 36 int l = random.nextInt(3); 37 38 // CraftBukkit start - prevent lava putting something on fire. 39 org.bukkit.World bworld = world.getWorld(); 40 BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA; 41 // CraftBukkit end 42 43 for (int i1 = 0; i1 < l; ++i1) { 44 i += random.nextInt(3) - 1; 45 ++j; 46 k += random.nextInt(3) - 1; 47 int j1 = world.getTypeId(i, j, k); 48 49 if (j1 == 0) { 50 if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) { 51 // CraftBukkit start - prevent lava putting something on fire. 52 org.bukkit.block.Block block = bworld.getBlockAt(i, j, k); 53 54 if (block.getTypeId() != Block.FIRE.id) { 55 BlockIgniteEvent event = new BlockIgniteEvent(block, igniteCause, null); 56 world.getServer().getPluginManager().callEvent(event); 57 58 if (event.isCancelled()) { 59 continue; 60 } 61 } 62 // CraftBukkit end 63 64 world.setTypeId(i, j, k, Block.FIRE.id); 65 return; 66 } 67 } else if (Block.byId[j1].material.isSolid()) { 68 return; 69 } 70 } 71 } 72 } 73 74 private boolean j(World world, int i, int j, int k) { 75 return world.getMaterial(i, j, k).isBurnable(); 76 } 77}