Update CraftBukkit to Minecraft 1.7.2
This commit is contained in:
@@ -13,37 +13,43 @@ public class BlockFire extends Block {
|
||||
private int[] a = new int[256];
|
||||
private int[] b = new int[256];
|
||||
|
||||
protected BlockFire(int i) {
|
||||
super(i, Material.FIRE);
|
||||
this.b(true);
|
||||
protected BlockFire() {
|
||||
super(Material.FIRE);
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
this.a(Block.WOOD.id, 5, 20);
|
||||
this.a(Block.WOOD_DOUBLE_STEP.id, 5, 20);
|
||||
this.a(Block.WOOD_STEP.id, 5, 20);
|
||||
this.a(Block.FENCE.id, 5, 20);
|
||||
this.a(Block.WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.BIRCH_WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.SPRUCE_WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.JUNGLE_WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.LOG.id, 5, 5);
|
||||
this.a(Block.LEAVES.id, 30, 60);
|
||||
this.a(Block.BOOKSHELF.id, 30, 20);
|
||||
this.a(Block.TNT.id, 15, 100);
|
||||
this.a(Block.LONG_GRASS.id, 60, 100);
|
||||
this.a(Block.WOOL.id, 30, 60);
|
||||
this.a(Block.VINE.id, 15, 100);
|
||||
this.a(Block.COAL_BLOCK.id, 5, 5);
|
||||
this.a(Block.HAY_BLOCK.id, 60, 20);
|
||||
public static void e() {
|
||||
Blocks.FIRE.a(b(Blocks.WOOD), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.WOOD_DOUBLE_STEP), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.WOOD_STEP), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.FENCE), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.WOOD_STAIRS), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.BIRCH_WOOD_STAIRS), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.SPRUCE_WOOD_STAIRS), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.JUNGLE_WOOD_STAIRS), 5, 20);
|
||||
Blocks.FIRE.a(b(Blocks.LOG), 5, 5);
|
||||
Blocks.FIRE.a(b(Blocks.LOG2), 5, 5);
|
||||
Blocks.FIRE.a(b(Blocks.LEAVES), 30, 60);
|
||||
Blocks.FIRE.a(b(Blocks.LEAVES2), 30, 60);
|
||||
Blocks.FIRE.a(b(Blocks.BOOKSHELF), 30, 20);
|
||||
Blocks.FIRE.a(b(Blocks.TNT), 15, 100);
|
||||
Blocks.FIRE.a(b(Blocks.LONG_GRASS), 60, 100);
|
||||
Blocks.FIRE.a(b(Blocks.DOUBLE_PLANT), 60, 100);
|
||||
Blocks.FIRE.a(b(Blocks.YELLOW_FLOWER), 60, 100);
|
||||
Blocks.FIRE.a(b(Blocks.RED_ROSE), 60, 100);
|
||||
Blocks.FIRE.a(b(Blocks.WOOL), 30, 60);
|
||||
Blocks.FIRE.a(b(Blocks.VINE), 15, 100);
|
||||
Blocks.FIRE.a(b(Blocks.COAL_BLOCK), 5, 5);
|
||||
Blocks.FIRE.a(b(Blocks.HAY_BLOCK), 60, 20);
|
||||
Blocks.FIRE.a(b(Blocks.WOOL_CARPET), 60, 20);
|
||||
}
|
||||
|
||||
private void a(int i, int j, int k) {
|
||||
public void a(int i, int j, int k) {
|
||||
this.a[i] = j;
|
||||
this.b[i] = k;
|
||||
}
|
||||
|
||||
public AxisAlignedBB b(World world, int i, int j, int k) {
|
||||
public AxisAlignedBB a(World world, int i, int j, int k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -51,11 +57,11 @@ public class BlockFire extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int b() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -69,9 +75,9 @@ public class BlockFire extends Block {
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.getGameRules().getBoolean("doFireTick")) {
|
||||
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
|
||||
boolean flag = world.getType(i, j - 1, k) == Blocks.NETHERRACK;
|
||||
|
||||
if (world.worldProvider instanceof WorldProviderTheEnd && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
|
||||
if (world.worldProvider instanceof WorldProviderTheEnd && world.getType(i, j - 1, k) == Blocks.BEDROCK) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -79,7 +85,7 @@ public class BlockFire extends Block {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
if (!flag && world.Q() && (world.isRainingAt(i, j, k) || world.isRainingAt(i - 1, j, k) || world.isRainingAt(i + 1, j, k) || world.isRainingAt(i, j, k - 1) || world.isRainingAt(i, j, k + 1))) {
|
||||
if (!flag && world.P() && (world.isRainingAt(i, j, k) || world.isRainingAt(i - 1, j, k) || world.isRainingAt(i + 1, j, k) || world.isRainingAt(i, j, k - 1) || world.isRainingAt(i, j, k + 1))) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
|
||||
} else {
|
||||
int l = world.getData(i, j, k);
|
||||
@@ -88,15 +94,15 @@ public class BlockFire extends Block {
|
||||
world.setData(i, j, k, l + random.nextInt(3) / 2, 4);
|
||||
}
|
||||
|
||||
world.a(i, j, k, this.id, this.a(world) + random.nextInt(10));
|
||||
if (!flag && !this.k(world, i, j, k)) {
|
||||
if (!world.w(i, j - 1, k) || l > 3) {
|
||||
world.a(i, j, k, this, this.a(world) + random.nextInt(10));
|
||||
if (!flag && !this.e(world, i, j, k)) {
|
||||
if (!World.a((IBlockAccess) world, i, j - 1, k) || l > 3) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - burn out of inflammable block
|
||||
}
|
||||
} else if (!flag && !this.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
|
||||
} else if (!flag && !this.e((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
|
||||
} else {
|
||||
boolean flag1 = world.G(i, j, k);
|
||||
boolean flag1 = world.z(i, j, k);
|
||||
byte b0 = 0;
|
||||
|
||||
if (flag1) {
|
||||
@@ -123,13 +129,13 @@ public class BlockFire extends Block {
|
||||
int i2 = this.m(world, i1, k1, j1);
|
||||
|
||||
if (i2 > 0) {
|
||||
int j2 = (i2 + 40 + world.difficulty * 7) / (l + 30);
|
||||
int j2 = (i2 + 40 + world.difficulty.a() * 7) / (l + 30);
|
||||
|
||||
if (flag1) {
|
||||
j2 /= 2;
|
||||
}
|
||||
|
||||
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.Q() || !world.isRainingAt(i1, k1, j1)) && !world.isRainingAt(i1 - 1, k1, k) && !world.isRainingAt(i1 + 1, k1, j1) && !world.isRainingAt(i1, k1, j1 - 1) && !world.isRainingAt(i1, k1, j1 + 1)) {
|
||||
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.P() || !world.isRainingAt(i1, k1, j1)) && !world.isRainingAt(i1 - 1, k1, k) && !world.isRainingAt(i1 + 1, k1, j1) && !world.isRainingAt(i1, k1, j1 - 1) && !world.isRainingAt(i1, k1, j1 + 1)) {
|
||||
int k2 = l + random.nextInt(5) / 4;
|
||||
|
||||
if (k2 > 15) {
|
||||
@@ -137,7 +143,7 @@ public class BlockFire extends Block {
|
||||
}
|
||||
|
||||
// CraftBukkit start - Call to stop spread of fire
|
||||
if (world.getTypeId(i1, k1, j1) != Block.FIRE.id) {
|
||||
if (world.getType(i1, k1, j1) != Blocks.FIRE) {
|
||||
if (CraftEventFactory.callBlockIgniteEvent(world, i1, k1, j1, i, j, k).isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
@@ -145,8 +151,8 @@ public class BlockFire extends Block {
|
||||
org.bukkit.Server server = world.getServer();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
blockState.setData(new org.bukkit.material.MaterialData(this.id, (byte) k2));
|
||||
blockState.setTypeId(Block.b(this));
|
||||
blockState.setData(new org.bukkit.material.MaterialData(Block.b(this), (byte) k2));
|
||||
|
||||
BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
|
||||
server.getPluginManager().callEvent(spreadEvent);
|
||||
@@ -167,15 +173,15 @@ public class BlockFire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
public boolean L() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void a(World world, int i, int j, int k, int l, Random random, int i1) {
|
||||
int j1 = this.b[world.getTypeId(i, j, k)];
|
||||
int j1 = this.b[Block.b(world.getType(i, j, k))];
|
||||
|
||||
if (random.nextInt(l) < j1) {
|
||||
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
||||
boolean flag = world.getType(i, j, k) == Blocks.TNT;
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);
|
||||
@@ -195,19 +201,19 @@ public class BlockFire extends Block {
|
||||
k1 = 15;
|
||||
}
|
||||
|
||||
world.setTypeIdAndData(i, j, k, this.id, k1, 3);
|
||||
world.setTypeAndData(i, j, k, this, k1, 3);
|
||||
} else {
|
||||
world.setAir(i, j, k);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
Block.TNT.postBreak(world, i, j, k, 1);
|
||||
Blocks.TNT.postBreak(world, i, j, k, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean k(World world, int i, int j, int k) {
|
||||
return this.d((IBlockAccess) world, i + 1, j, k) ? true : (this.d((IBlockAccess) world, i - 1, j, k) ? true : (this.d((IBlockAccess) world, i, j - 1, k) ? true : (this.d((IBlockAccess) world, i, j + 1, k) ? true : (this.d((IBlockAccess) world, i, j, k - 1) ? true : this.d((IBlockAccess) world, i, j, k + 1)))));
|
||||
private boolean e(World world, int i, int j, int k) {
|
||||
return this.e((IBlockAccess) world, i + 1, j, k) ? true : (this.e((IBlockAccess) world, i - 1, j, k) ? true : (this.e((IBlockAccess) world, i, j - 1, k) ? true : (this.e((IBlockAccess) world, i, j + 1, k) ? true : (this.e((IBlockAccess) world, i, j, k - 1) ? true : this.e((IBlockAccess) world, i, j, k + 1)))));
|
||||
}
|
||||
|
||||
private int m(World world, int i, int j, int k) {
|
||||
@@ -216,54 +222,58 @@ public class BlockFire extends Block {
|
||||
if (!world.isEmpty(i, j, k)) {
|
||||
return 0;
|
||||
} else {
|
||||
int l = this.d(world, i + 1, j, k, b0);
|
||||
int l = this.a(world, i + 1, j, k, b0);
|
||||
|
||||
l = this.d(world, i - 1, j, k, l);
|
||||
l = this.d(world, i, j - 1, k, l);
|
||||
l = this.d(world, i, j + 1, k, l);
|
||||
l = this.d(world, i, j, k - 1, l);
|
||||
l = this.d(world, i, j, k + 1, l);
|
||||
l = this.a(world, i - 1, j, k, l);
|
||||
l = this.a(world, i, j - 1, k, l);
|
||||
l = this.a(world, i, j + 1, k, l);
|
||||
l = this.a(world, i, j, k - 1, l);
|
||||
l = this.a(world, i, j, k + 1, l);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean m() {
|
||||
public boolean v() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
|
||||
public boolean e(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.a[Block.b(iblockaccess.getType(i, j, k))] > 0;
|
||||
}
|
||||
|
||||
public int d(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.a[world.getTypeId(i, j, k)];
|
||||
public int a(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.a[Block.b(world.getType(i, j, k))];
|
||||
|
||||
return i1 > l ? i1 : l;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.w(i, j - 1, k) || this.k(world, i, j, k);
|
||||
return World.a((IBlockAccess) world, i, j - 1, k) || this.e(world, i, j, k);
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
|
||||
public void doPhysics(World world, int i, int j, int k, Block block) {
|
||||
if (!World.a((IBlockAccess) world, i, j - 1, k) && !this.e(world, i, j, k)) {
|
||||
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.o_(world, i, j, k)) {
|
||||
if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
|
||||
if (world.worldProvider.dimension > 0 || !Blocks.PORTAL.e(world, i, j, k)) {
|
||||
if (!World.a((IBlockAccess) world, i, j - 1, k) && !this.e(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
|
||||
} else {
|
||||
world.a(i, j, k, this.id, this.a(world) + world.random.nextInt(10));
|
||||
world.a(i, j, k, this, this.a(world) + world.random.nextInt(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MaterialMapColor f(int i) {
|
||||
return MaterialMapColor.f;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
private void fireExtinguished(World world, int x, int y, int z) {
|
||||
if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled()) {
|
||||
if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), Blocks.AIR).isCancelled()) {
|
||||
world.setAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user