diff options
author | sk89q <the.sk89q@gmail.com> | 2011-01-30 13:54:03 -0800 |
---|---|---|
committer | sk89q <the.sk89q@gmail.com> | 2011-01-30 13:54:20 -0800 |
commit | 9831f3960dbe56021e4b7e212b9593af7d25210a (patch) | |
tree | 0c196e2a25018152f1b3eb532202b15041bafebb /src | |
parent | 8911adae0573379117741c3b976da4864719fd94 (diff) | |
download | bukkit-9831f3960dbe56021e4b7e212b9593af7d25210a.tar bukkit-9831f3960dbe56021e4b7e212b9593af7d25210a.tar.gz bukkit-9831f3960dbe56021e4b7e212b9593af7d25210a.tar.lz bukkit-9831f3960dbe56021e4b7e212b9593af7d25210a.tar.xz bukkit-9831f3960dbe56021e4b7e212b9593af7d25210a.zip |
Added support for different tree generation types and a callback.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/BlockChangeDelegate.java | 42 | ||||
-rw-r--r-- | src/main/java/org/bukkit/TreeType.java | 14 | ||||
-rw-r--r-- | src/main/java/org/bukkit/World.java | 12 |
3 files changed, 64 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/BlockChangeDelegate.java b/src/main/java/org/bukkit/BlockChangeDelegate.java new file mode 100644 index 00000000..6bc62734 --- /dev/null +++ b/src/main/java/org/bukkit/BlockChangeDelegate.java @@ -0,0 +1,42 @@ +package org.bukkit;
+
+/**
+ * A delegate for handling block changes. This serves as a direct interface
+ * between generation algorithms in the server implementation and utilizing
+ * code.
+ *
+ * @author sk89q
+ */
+public interface BlockChangeDelegate {
+ /**
+ * Set a block type at the specified coordinates.
+ *
+ * @param x
+ * @param y
+ * @param z
+ * @param typeId
+ * @return true if the block was set successfully
+ */
+ public boolean setTypeId(int x, int y, int z, int typeId);
+
+ /**
+ * Set a block type and data at the specified coordinates.
+ *
+ * @param x
+ * @param y
+ * @param z
+ * @param typeId
+ * @param data
+ * @return true if the block was set successfully
+ */
+ public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data);
+
+ /**
+ * Get the block type at the location.
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ public int getTypeId(int x, int y, int z);
+}
diff --git a/src/main/java/org/bukkit/TreeType.java b/src/main/java/org/bukkit/TreeType.java new file mode 100644 index 00000000..489b1d96 --- /dev/null +++ b/src/main/java/org/bukkit/TreeType.java @@ -0,0 +1,14 @@ +package org.bukkit;
+
+/**
+ * Tree type.
+ *
+ * @author sk89q
+ */
+public enum TreeType {
+ TREE,
+ BIG_TREE,
+ REDWOOD,
+ TALL_REDWOOD,
+ BIRCH
+}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java index 046e884d..3fd21db2 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -115,17 +115,21 @@ public interface World { * Spawns a tree at a location. * * @param loc + * @param type * @return whether the tree was created */ - public boolean generateTree(Location loc); - + public boolean generateTree(Location loc, TreeType type); + /** - * Spawns a big tree at a location. + * Spawns a tree at a location. * * @param loc + * @param type + * @param delegate * @return whether the tree was created */ - public boolean generateBigTree(Location loc); + public boolean generateTree(Location loc, TreeType type, + BlockChangeDelegate delegate); /** * Spawns a regular passenger minecart. |