2011-01-10 22:07:56 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2011-01-18 22:44:01 +01:00
|
|
|
// CraftBukkit start
|
|
|
|
import org.bukkit.Server;
|
|
|
|
import org.bukkit.entity.Player;
|
2011-01-10 22:07:56 +01:00
|
|
|
import org.bukkit.event.block.BlockIgniteEvent;
|
2011-01-18 22:44:01 +01:00
|
|
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
2011-01-10 22:07:56 +01:00
|
|
|
import org.bukkit.craftbukkit.CraftWorld;
|
|
|
|
import java.util.Random;
|
2011-01-18 22:44:01 +01:00
|
|
|
// CraftBukkit end
|
2011-01-10 22:07:56 +01:00
|
|
|
|
|
|
|
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);
|
2011-01-14 14:31:10 +01:00
|
|
|
if (world.a(k, l, i1) == bi) {
|
2011-01-10 22:07:56 +01:00
|
|
|
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;
|
2011-01-14 14:31:10 +01:00
|
|
|
world.a(k, l, i1, bi - 1, j1);
|
2011-01-10 22:07:56 +01:00
|
|
|
world.b(k, l, i1, k, l, i1);
|
2011-01-14 22:22:14 +01:00
|
|
|
world.i(k, l, i1, bi - 1);
|
2011-01-10 22:07:56 +01:00
|
|
|
world.i = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(World world, int k, int l, int i1, Random random) {
|
2011-01-14 14:31:10 +01:00
|
|
|
if (bt == Material.g) {
|
2011-01-10 22:07:56 +01:00
|
|
|
int j1 = random.nextInt(3);
|
2011-01-14 14:31:10 +01:00
|
|
|
|
|
|
|
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) {
|
2011-01-18 22:44:01 +01:00
|
|
|
// this checks if an adjacent block is flammable before lighting this block.
|
|
|
|
// perhaps we can reduce spam by checking this earlier.
|
2011-01-14 14:31:10 +01:00
|
|
|
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)) {
|
2011-01-18 22:44:01 +01:00
|
|
|
// CraftBukkit start: prevent lava putting something on fire.
|
|
|
|
Server server = ((WorldServer)world).getServer();
|
|
|
|
CraftWorld cworld = ((WorldServer)world).getWorld();
|
|
|
|
|
|
|
|
org.bukkit.block.Block theBlock = cworld.getBlockAt(k, l, i1);
|
|
|
|
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
|
|
|
Player thePlayer = null;
|
|
|
|
|
|
|
|
if (theBlock.getTypeId() != Block.ar.bi){
|
|
|
|
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
|
|
|
server.getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-01-14 14:31:10 +01:00
|
|
|
world.e(k, l, i1, Block.ar.bi);
|
2011-01-10 22:07:56 +01:00
|
|
|
return;
|
|
|
|
}
|
2011-01-14 14:31:10 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (Block.m[l1].bt.c()) {
|
|
|
|
return;
|
2011-01-10 22:07:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean j(World world, int k, int l, int i1) {
|
|
|
|
return world.c(k, l, i1).e();
|
|
|
|
}
|
|
|
|
}
|