From 2726696652179a5ead7dc07dd39edf7dfda687f7 Mon Sep 17 00:00:00 2001 From: mbax Date: Mon, 4 Nov 2013 07:07:38 -0600 Subject: Update CraftBukkit to Minecraft 1.7.2 --- src/main/java/net/minecraft/server/BlockVine.java | 137 ++++++++++------------ 1 file changed, 65 insertions(+), 72 deletions(-) (limited to 'src/main/java/net/minecraft/server/BlockVine.java') diff --git a/src/main/java/net/minecraft/server/BlockVine.java b/src/main/java/net/minecraft/server/BlockVine.java index 22c50bd4..5033a10c 100644 --- a/src/main/java/net/minecraft/server/BlockVine.java +++ b/src/main/java/net/minecraft/server/BlockVine.java @@ -6,9 +6,9 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit public class BlockVine extends Block { - public BlockVine(int i) { - super(i, Material.REPLACEABLE_PLANT); - this.b(true); + public BlockVine() { + super(Material.REPLACEABLE_PLANT); + this.a(true); this.a(CreativeModeTab.c); } @@ -16,7 +16,7 @@ public class BlockVine extends Block { this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public int d() { + public int b() { return 20; } @@ -24,7 +24,7 @@ public class BlockVine extends Block { return false; } - public boolean b() { + public boolean d() { return false; } @@ -79,7 +79,7 @@ public class BlockVine extends Block { flag = true; } - if (!flag && this.d(iblockaccess.getTypeId(i, j + 1, k))) { + if (!flag && this.a(iblockaccess.getType(i, j + 1, k))) { f2 = Math.min(f2, 0.9375F); f5 = 1.0F; f1 = 0.0F; @@ -91,43 +91,37 @@ public class BlockVine extends Block { this.a(f1, f2, f3, f4, f5, f6); } - public AxisAlignedBB b(World world, int i, int j, int k) { + public AxisAlignedBB a(World world, int i, int j, int k) { return null; } public boolean canPlace(World world, int i, int j, int k, int l) { switch (l) { case 1: - return this.d(world.getTypeId(i, j + 1, k)); + return this.a(world.getType(i, j + 1, k)); case 2: - return this.d(world.getTypeId(i, j, k + 1)); + return this.a(world.getType(i, j, k + 1)); case 3: - return this.d(world.getTypeId(i, j, k - 1)); + return this.a(world.getType(i, j, k - 1)); case 4: - return this.d(world.getTypeId(i + 1, j, k)); + return this.a(world.getType(i + 1, j, k)); case 5: - return this.d(world.getTypeId(i - 1, j, k)); + return this.a(world.getType(i - 1, j, k)); default: return false; } } - private boolean d(int i) { - if (i == 0) { - return false; - } else { - Block block = Block.byId[i]; - - return block.b() && block.material.isSolid(); - } + private boolean a(Block block) { + return block.d() && block.material.isSolid(); } - private boolean k(World world, int i, int j, int k) { + private boolean e(World world, int i, int j, int k) { int l = world.getData(i, j, k); int i1 = l; @@ -135,13 +129,13 @@ public class BlockVine extends Block { for (int j1 = 0; j1 <= 3; ++j1) { int k1 = 1 << j1; - if ((l & k1) != 0 && !this.d(world.getTypeId(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getTypeId(i, j + 1, k) != this.id || (world.getData(i, j + 1, k) & k1) == 0)) { + if ((l & k1) != 0 && !this.a(world.getType(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getType(i, j + 1, k) != this || (world.getData(i, j + 1, k) & k1) == 0)) { i1 &= ~k1; } } } - if (i1 == 0 && !this.d(world.getTypeId(i, j + 1, k))) { + if (i1 == 0 && !this.a(world.getType(i, j + 1, k))) { return false; } else { if (i1 != l) { @@ -152,9 +146,9 @@ public class BlockVine extends Block { } } - public void doPhysics(World world, int i, int j, int k, int l) { - if (!world.isStatic && !this.k(world, i, j, k)) { - this.c(world, i, j, k, world.getData(i, j, k), 0); + public void doPhysics(World world, int i, int j, int k, Block block) { + if (!world.isStatic && !this.e(world, i, j, k)) { + this.b(world, i, j, k, world.getData(i, j, k), 0); world.setAir(i, j, k); } } @@ -169,15 +163,15 @@ public class BlockVine extends Block { int j1; int k1; - label138: + label134: for (i1 = i - b0; i1 <= i + b0; ++i1) { for (j1 = k - b0; j1 <= k + b0; ++j1) { for (k1 = j - 1; k1 <= j + 1; ++k1) { - if (world.getTypeId(i1, k1, j1) == this.id) { + if (world.getType(i1, k1, j1) == this) { --l; if (l <= 0) { flag = true; - break label138; + break label134; } } } @@ -188,30 +182,31 @@ public class BlockVine extends Block { j1 = world.random.nextInt(6); k1 = Direction.e[j1]; int l1; - int i2; if (j1 == 1 && j < 255 && world.isEmpty(i, j + 1, k)) { if (flag) { return; } - l1 = world.random.nextInt(16) & i1; - if (l1 > 0) { - for (i2 = 0; i2 <= 3; ++i2) { - if (!this.d(world.getTypeId(i + Direction.a[i2], j + 1, k + Direction.b[i2]))) { - l1 &= ~(1 << i2); + int i2 = world.random.nextInt(16) & i1; + + if (i2 > 0) { + for (l1 = 0; l1 <= 3; ++l1) { + if (!this.a(world.getType(i + Direction.a[l1], j + 1, k + Direction.b[l1]))) { + i2 &= ~(1 << l1); } } - if (l1 > 0) { + if (i2 > 0) { // CraftBukkit start - Call BlockSpreadEvent org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j + 1, k); - CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1); + CraftEventFactory.handleBlockSpreadEvent(block, source, this, l1); // CraftBukkit end } } } else { + Block block; int j2; if (j1 >= 2 && j1 <= 5 && (i1 & 1 << k1) == 0) { @@ -219,49 +214,47 @@ public class BlockVine extends Block { return; } - l1 = world.getTypeId(i + Direction.a[k1], j, k + Direction.b[k1]); - if (l1 != 0 && Block.byId[l1] != null) { - if (Block.byId[l1].material.k() && Block.byId[l1].b()) { - world.setData(i, j, k, i1 | 1 << k1, 2); - } - } else { - i2 = k1 + 1 & 3; + block = world.getType(i + Direction.a[k1], j, k + Direction.b[k1]); + if (block.material == Material.AIR) { + l1 = k1 + 1 & 3; j2 = k1 + 3 & 3; // CraftBukkit start - Call BlockSpreadEvent org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); - org.bukkit.block.Block block = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]); - if ((i1 & 1 << i2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) { - CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << i2); - } else if ((i1 & 1 << j2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) { - CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << j2); - } else if ((i1 & 1 << i2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]) && this.d(world.getTypeId(i + Direction.a[i2], j, k + Direction.b[i2]))) { - block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]); - CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3)); - } else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.d(world.getTypeId(i + Direction.a[j2], j, k + Direction.b[j2]))) { - block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]); - CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3)); - } else if (this.d(world.getTypeId(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) { - CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 0); + org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]); + if ((i1 & 1 << l1) != 0 && this.a(world.getType(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]))) { + CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << l1); + } else if ((i1 & 1 << j2) != 0 && this.a(world.getType(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) { + CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << j2); + } else if ((i1 & 1 << l1) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]) && this.a(world.getType(i + Direction.a[l1], j, k + Direction.b[l1]))) { + bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]); + CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3)); + } else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.a(world.getType(i + Direction.a[j2], j, k + Direction.b[j2]))) { + bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]); + CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3)); + } else if (this.a(world.getType(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) { + CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 0); } // CraftBukkit end + } else if (block.material.k() && block.d()) { + world.setData(i, j, k, i1 | 1 << k1, 2); } } else if (j > 1) { - l1 = world.getTypeId(i, j - 1, k); - if (l1 == 0) { - i2 = world.random.nextInt(16) & i1; - if (i2 > 0) { + block = world.getType(i, j - 1, k); + if (block.material == Material.AIR) { + l1 = world.random.nextInt(16) & i1; + if (l1 > 0) { // CraftBukkit start - Call BlockSpreadEvent org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); - org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j - 1, k); - CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2); + org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j - 1, k); + CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, l1); // CraftBukkit end } - } else if (l1 == this.id) { - i2 = world.random.nextInt(16) & i1; + } else if (block == this) { + l1 = world.random.nextInt(16) & i1; j2 = world.getData(i, j - 1, k); - if (j2 != (j2 | i2)) { - world.setData(i, j - 1, k, j2 | i2, 2); + if (j2 != (j2 | l1)) { + world.setData(i, j - 1, k, j2 | l1, 2); } } } @@ -292,8 +285,8 @@ public class BlockVine extends Block { return b0 != 0 ? b0 : i1; } - public int getDropType(int i, Random random, int j) { - return 0; + public Item getDropType(int i, Random random, int j) { + return null; } public int a(Random random) { @@ -301,9 +294,9 @@ public class BlockVine extends Block { } 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.VINE, 1, 0)); + 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(Blocks.VINE, 1, 0)); } else { super.a(world, entityhuman, i, j, k, l); } -- cgit v1.2.3