diff options
author | zml2008 <zach@zachsthings.com> | 2012-03-13 19:38:39 -0700 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-21 20:32:17 -0400 |
commit | 8aee4c3f563f8a6e5e2f5b3233c25097487bf6c4 (patch) | |
tree | 93b30ead7171fb8bc06644f0bb7a30d8aab31b78 /src/main/java/org/bukkit | |
parent | 27acb4c41e118a696b001770a16bd84020a26f36 (diff) | |
download | craftbukkit-8aee4c3f563f8a6e5e2f5b3233c25097487bf6c4.tar craftbukkit-8aee4c3f563f8a6e5e2f5b3233c25097487bf6c4.tar.gz craftbukkit-8aee4c3f563f8a6e5e2f5b3233c25097487bf6c4.tar.lz craftbukkit-8aee4c3f563f8a6e5e2f5b3233c25097487bf6c4.tar.xz craftbukkit-8aee4c3f563f8a6e5e2f5b3233c25097487bf6c4.zip |
[Bleeding] Added support for all TreeType entries to CraftWorld.generateTree(). Addresses BUKKIT-1161
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 36 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java | 8 |
2 files changed, 39 insertions, 5 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 2c41ba89..25967d91 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -369,19 +369,45 @@ public class CraftWorld implements World { } public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { + BlockSapling.TreeGenerator gen; switch (type) { case BIG_TREE: - return new WorldGenBigTree(false).generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + gen = new WorldGenBigTree(true); + break; case BIRCH: - return new WorldGenForest(false).generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + gen = new WorldGenForest(true); + break; case REDWOOD: - return new WorldGenTaiga2(false).generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + gen = new WorldGenTaiga2(true); + break; case TALL_REDWOOD: - return new WorldGenTaiga1().generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + gen = new WorldGenTaiga1(); + break; + case JUNGLE: + gen = new WorldGenMegaTree(true, 10 + rand.nextInt(20), 3, 3); + break; + case SMALL_JUNGLE: + gen = new WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false); + break; + case JUNGLE_BUSH: + gen = new WorldGenGroundBush(3, 0); + break; + case RED_MUSHROOM: + gen = new WorldGenHugeMushroom(1); + break; + case BROWN_MUSHROOM: + gen = new WorldGenHugeMushroom(0); + break; + case SWAMP: + gen = new WorldGenSwampTree(); + break; case TREE: default: - return new WorldGenTrees(false).generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + gen = new WorldGenTrees(true); + break; } + + return gen.generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); } public TileEntity getTileEntityAt(final int x, final int y, final int z) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java b/src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java index f7bab681..6566b9e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java +++ b/src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java @@ -30,6 +30,14 @@ public class StructureGrowDelegate implements BlockChangeDelegate { return true; } + public boolean setTypeId(int x, int y, int z, int typeId) { + return setRawTypeId(x, y, z, typeId); + } + + public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data) { + return setRawTypeIdAndData(x, y, z, typeId, data); + } + public int getTypeId(int x, int y, int z) { return world.getBlockTypeIdAt(x, y, z); } |