Update CraftBukkit to Minecraft 1.7.2

This commit is contained in:
mbax
2013-11-04 07:07:38 -06:00
committed by Wesley Wolfe
parent ff8b70fbb7
commit 2726696652
349 changed files with 14339 additions and 11287 deletions

View File

@@ -4,33 +4,32 @@ import java.util.Random;
import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
public class BlockLeaves extends BlockTransparant {
public abstract class BlockLeaves extends BlockTransparent {
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
public static final String[][] b = new String[][] { { "leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, { "leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}};
private IIcon[][] cX = new IIcon[2][];
int[] c;
int[] a;
protected IIcon[][] M = new IIcon[2][];
protected BlockLeaves(int i) {
super(i, Material.LEAVES, false);
this.b(true);
public BlockLeaves() {
super(Material.LEAVES, false);
this.a(true);
this.a(CreativeModeTab.c);
this.c(0.2F);
this.g(1);
this.a(h);
}
public void remove(World world, int i, int j, int k, int l, int i1) {
public void remove(World world, int i, int j, int k, Block block, int l) {
byte b0 = 1;
int j1 = b0 + 1;
int i1 = b0 + 1;
if (world.e(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
for (int k1 = -b0; k1 <= b0; ++k1) {
for (int l1 = -b0; l1 <= b0; ++l1) {
for (int i2 = -b0; i2 <= b0; ++i2) {
int j2 = world.getTypeId(i + k1, j + l1, k + i2);
if (world.b(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
for (int j1 = -b0; j1 <= b0; ++j1) {
for (int k1 = -b0; k1 <= b0; ++k1) {
for (int l1 = -b0; l1 <= b0; ++l1) {
if (world.getType(i + j1, j + k1, k + l1).getMaterial() == Material.LEAVES) {
int i2 = world.getData(i + j1, j + k1, k + l1);
if (j2 == Block.LEAVES.id) {
int k2 = world.getData(i + k1, j + l1, k + i2);
world.setData(i + k1, j + l1, k + i2, k2 | 8, 4);
world.setData(i + j1, j + k1, k + l1, i2 | 8, 4);
}
}
}
@@ -49,27 +48,29 @@ public class BlockLeaves extends BlockTransparant {
int j1 = b1 * b1;
int k1 = b1 / 2;
if (this.c == null) {
this.c = new int[b1 * b1 * b1];
if (this.a == null) {
this.a = new int[b1 * b1 * b1];
}
int l1;
if (world.e(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
if (world.b(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
int i2;
int j2;
int k2;
for (l1 = -b0; l1 <= b0; ++l1) {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
k2 = world.getTypeId(i + l1, j + i2, k + j2);
if (k2 == Block.LOG.id) {
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
} else if (k2 == Block.LEAVES.id) {
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
Block block = world.getType(i + l1, j + i2, k + j2);
if (block != Blocks.LOG && block != Blocks.LOG2) {
if (block.getMaterial() == Material.LEAVES) {
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
} else {
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
}
} else {
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
}
}
}
@@ -78,30 +79,30 @@ public class BlockLeaves extends BlockTransparant {
for (l1 = 1; l1 <= 4; ++l1) {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
for (k2 = -b0; k2 <= b0; ++k2) {
if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
if (this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
for (int k2 = -b0; k2 <= b0; ++k2) {
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
if (this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
if (this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
}
}
}
@@ -110,17 +111,17 @@ public class BlockLeaves extends BlockTransparant {
}
}
l1 = this.c[k1 * j1 + k1 * b1 + k1];
l1 = this.a[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) {
world.setData(i, j, k, l & -9, 4);
} else {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
}
}
}
private void k(World world, int i, int j, int k) {
private void e(World world, int i, int j, int k) {
// CraftBukkit start
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent(event);
@@ -130,7 +131,7 @@ public class BlockLeaves extends BlockTransparant {
}
// CraftBukkit end
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
@@ -138,17 +139,13 @@ public class BlockLeaves extends BlockTransparant {
return random.nextInt(20) == 0 ? 1 : 0;
}
public int getDropType(int i, Random random, int j) {
return Block.SAPLING.id;
public Item getDropType(int i, Random random, int j) {
return Item.getItemOf(Blocks.SAPLING);
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) {
int j1 = 20;
if ((l & 3) == 3) {
j1 = 40;
}
int j1 = this.b(l);
if (i1 > 0) {
j1 -= 2 << i1;
@@ -158,9 +155,9 @@ public class BlockLeaves extends BlockTransparant {
}
if (world.random.nextInt(j1) == 0) {
int k1 = this.getDropType(l, world.random, i1);
Item item = this.getDropType(l, world.random, i1);
this.b(world, i, j, k, new ItemStack(k1, 1, this.getDropData(l)));
this.a(world, i, j, k, new ItemStack(item, 1, this.getDropData(l)));
}
j1 = 200;
@@ -171,16 +168,20 @@ public class BlockLeaves extends BlockTransparant {
}
}
if ((l & 3) == 0 && world.random.nextInt(j1) == 0) {
this.b(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
}
this.c(world, i, j, k, l, j1);
}
}
protected void c(World world, int i, int j, int k, int l, int i1) {}
protected int b(int i) {
return 20;
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.by() != null && entityhuman.by().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
if (!world.isStatic && entityhuman.bD() != null && entityhuman.bD().getItem() == Items.SHEARS) {
entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
this.a(world, i, j, k, new ItemStack(Item.getItemOf(this), 1, l & 3));
} else {
super.a(world, entityhuman, i, j, k, l);
}
@@ -191,10 +192,12 @@ public class BlockLeaves extends BlockTransparant {
}
public boolean c() {
return !this.d;
return !this.P;
}
protected ItemStack d_(int i) {
return new ItemStack(this.id, 1, i & 3);
protected ItemStack j(int i) {
return new ItemStack(Item.getItemOf(this), 1, i & 3);
}
public abstract String[] e();
}