diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockSapling.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockSapling.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index 27853ae7..9495da10 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -11,16 +11,19 @@ import org.bukkit.event.world.StructureGrowEvent; public class BlockSapling extends BlockFlower { + public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"}; + protected BlockSapling(int i, int j) { super(i, j); float f = 0.4F; this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); + this.a(CreativeModeTab.c); } - public void a(World world, int i, int j, int k, Random random) { + public void b(World world, int i, int j, int k, Random random) { if (!world.isStatic) { - super.a(world, i, j, k, random); + super.b(world, i, j, k, random); if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) { int l = world.getData(i, j, k); @@ -43,12 +46,12 @@ public class BlockSapling extends BlockFlower { int l = world.getData(i, j, k) & 3; int i1 = 0; int j1 = 0; + boolean flag = false; // CraftBukkit start - records tree generation and calls StructureGrowEvent StructureGrowDelegate delegate = new StructureGrowDelegate(world); TreeType treeType = null; TreeGenerator gen = null; boolean grownTree = false; - boolean flag = false; if (l == 1) { treeType = TreeType.REDWOOD; @@ -59,7 +62,7 @@ public class BlockSapling extends BlockFlower { } else if (l == 3) { for (i1 = 0; i1 >= -1; --i1) { for (j1 = 0; j1 >= -1; --j1) { - if (this.f(world, i + i1, j, k + j1, 3) && this.f(world, i + i1 + 1, j, k + j1, 3) && this.f(world, i + i1, j, k + j1 + 1, 3) && this.f(world, i + i1 + 1, j, k + j1 + 1, 3)) { + if (this.e(world, i + i1, j, k + j1, 3) && this.e(world, i + i1 + 1, j, k + j1, 3) && this.e(world, i + i1, j, k + j1 + 1, 3) && this.e(world, i + i1 + 1, j, k + j1 + 1, 3)) { treeType = TreeType.JUNGLE; gen = new WorldGenMegaTree(false, 10 + random.nextInt(20), 3, 3); flag = true; @@ -95,6 +98,7 @@ public class BlockSapling extends BlockFlower { } else { world.setRawTypeId(i, j, k, 0); } + grownTree = gen.generate(delegate, random, i + i1, j, k + j1); if (grownTree) { Location location = new Location(world.getWorld(), i, j, k); @@ -124,7 +128,7 @@ public class BlockSapling extends BlockFlower { // CraftBukkit end } - public boolean f(World world, int i, int j, int k, int l) { + public boolean e(World world, int i, int j, int k, int l) { return world.getTypeId(i, j, k) == this.id && (world.getData(i, j, k) & 3) == l; } |