diff options
author | sk89q <the.sk89q@gmail.com> | 2011-01-02 18:01:17 -0800 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-03 03:27:47 +0000 |
commit | b2812b74d4a9c4646f72f9608cf660abede09427 (patch) | |
tree | 4426523d79b19265d408407edb6f746f088d335b /src/main/java | |
parent | fe34bbbb10cbf6f95b49d565e16562f9c12e8b7e (diff) | |
download | craftbukkit-b2812b74d4a9c4646f72f9608cf660abede09427.tar craftbukkit-b2812b74d4a9c4646f72f9608cf660abede09427.tar.gz craftbukkit-b2812b74d4a9c4646f72f9608cf660abede09427.tar.lz craftbukkit-b2812b74d4a9c4646f72f9608cf660abede09427.tar.xz craftbukkit-b2812b74d4a9c4646f72f9608cf660abede09427.zip |
Added world.spawnTree(), world.spawnBigTree().
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 1e072f0f..25a7bd18 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -3,9 +3,11 @@ package org.bukkit.craftbukkit; import java.util.HashMap; import java.util.Map; +import java.util.Random; +import net.minecraft.server.WorldGenBigTree; +import net.minecraft.server.WorldGenTrees; import net.minecraft.server.WorldServer; import net.minecraft.server.EntityArrow; - import org.bukkit.ArrowEntity; import org.bukkit.Block; import org.bukkit.Chunk; @@ -17,6 +19,8 @@ public class CraftWorld implements World { private final Map<ChunkCoordinate, Chunk> chunkCache = new HashMap<ChunkCoordinate, Chunk>(); private final Map<BlockCoordinate, Block> blockCache = new HashMap<BlockCoordinate, Block>(); private final WorldServer world; + + private static final Random rand = new Random(); public CraftWorld(WorldServer world) { this.world = world; @@ -83,6 +87,18 @@ public class CraftWorld implements World { arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread); return new CraftArrowEntity(world.getServer(), arrow); } + + public boolean generateTree(Location loc) { + WorldGenTrees treeGen = new WorldGenTrees(); + return treeGen.a(world, rand, + loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + } + + public boolean generateBigTree(Location loc) { + WorldGenBigTree treeGen = new WorldGenBigTree(); + return treeGen.a(world, rand, + loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + } @Override public String toString() { |