diff options
author | sk89q <the.sk89q@gmail.com> | 2011-01-03 14:03:17 +0800 |
---|---|---|
committer | Dinner Bone <dinnerbone@dinnerbone.com> | 2011-01-03 22:24:43 +0800 |
commit | 5d6b436ad388d2324e1c95a17bd8f6c4e34cb513 (patch) | |
tree | 869863db7b538922fbe0b6831d6d1717b7425760 /src/main/java | |
parent | bb87bcdd74afee1c4d291fd962c278de0ea8f66b (diff) | |
download | bukkit-5d6b436ad388d2324e1c95a17bd8f6c4e34cb513.tar bukkit-5d6b436ad388d2324e1c95a17bd8f6c4e34cb513.tar.gz bukkit-5d6b436ad388d2324e1c95a17bd8f6c4e34cb513.tar.lz bukkit-5d6b436ad388d2324e1c95a17bd8f6c4e34cb513.tar.xz bukkit-5d6b436ad388d2324e1c95a17bd8f6c4e34cb513.zip |
Added minecart classes, vehicle class, and the ability to spawn minecarts. StorageMinecart needs a getInventory(), but that is waiting on the addition of inventory code.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/Minecart.java | 22 | ||||
-rw-r--r-- | src/main/java/org/bukkit/PoweredMinecart.java | 10 | ||||
-rw-r--r-- | src/main/java/org/bukkit/StorageMinecart.java | 9 | ||||
-rw-r--r-- | src/main/java/org/bukkit/Vehicle.java | 37 | ||||
-rw-r--r-- | src/main/java/org/bukkit/World.java | 26 |
5 files changed, 103 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/Minecart.java b/src/main/java/org/bukkit/Minecart.java new file mode 100644 index 00000000..275a084e --- /dev/null +++ b/src/main/java/org/bukkit/Minecart.java @@ -0,0 +1,22 @@ +package org.bukkit;
+
+/**
+ * Represents a minecart entity.
+ *
+ * @author sk89q
+ */
+public interface Minecart extends Vehicle {
+ /**
+ * Sets a minecart's damage.
+ *
+ * @param damage over 40 to "kill" a minecart
+ */
+ public void setDamage(int damage);
+
+ /**
+ * Gets a minecart's damage.
+ *
+ * @param damage
+ */
+ public int getDamage();
+}
diff --git a/src/main/java/org/bukkit/PoweredMinecart.java b/src/main/java/org/bukkit/PoweredMinecart.java new file mode 100644 index 00000000..c6ca4716 --- /dev/null +++ b/src/main/java/org/bukkit/PoweredMinecart.java @@ -0,0 +1,10 @@ +package org.bukkit;
+
+/**
+ * Represents a powered minecart.
+ *
+ * @author sk89q
+ */
+public interface PoweredMinecart extends Minecart {
+
+}
diff --git a/src/main/java/org/bukkit/StorageMinecart.java b/src/main/java/org/bukkit/StorageMinecart.java new file mode 100644 index 00000000..2d4a4afb --- /dev/null +++ b/src/main/java/org/bukkit/StorageMinecart.java @@ -0,0 +1,9 @@ +package org.bukkit;
+
+/**
+ * Represents a storage minecart.
+ *
+ * @author sk89q
+ */
+public interface StorageMinecart extends Minecart {
+}
diff --git a/src/main/java/org/bukkit/Vehicle.java b/src/main/java/org/bukkit/Vehicle.java new file mode 100644 index 00000000..245c671f --- /dev/null +++ b/src/main/java/org/bukkit/Vehicle.java @@ -0,0 +1,37 @@ +package org.bukkit;
+
+/**
+ * Represents a vehicle entity.
+ *
+ * @author sk89q
+ */
+public interface Vehicle extends Entity {
+ /**
+ * Gets the vehicle's velocity.
+ *
+ * @return velocity vector
+ */
+ public Vector getVelocity();
+
+ /**
+ * Sets the vehicle's velocity.
+ *
+ * @param vel velocity vector
+ */
+ public void setVelocity(Vector vel);
+
+ /**
+ * Gets the primary passenger of a vehicle. For vehicles that could have
+ * multiple passengers, this will only return the primary passenger.
+ *
+ * @return a living entity
+ */
+ public LivingEntity getPassenger();
+
+ /**
+ * Returns true if the vehicle has no passengers.
+ *
+ * @return
+ */
+ public boolean isEmpty();
+}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java index deef7314..5b03ebff 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -63,7 +63,7 @@ public interface World { * @return whether the tree was created */ public boolean generateTree(Location loc); - + /** * Spawns a big tree at a location. * @@ -71,4 +71,28 @@ public interface World { * @return whether the tree was created */ public boolean generateBigTree(Location loc); + + /** + * Spawns a regular passenger minecart. + * + * @param loc + * @return + */ + public Minecart spawnMinecart(Location loc); + + /** + * Spawns a storage minecart. + * + * @param loc + * @return + */ + public StorageMinecart spawnStorageMinecart(Location loc); + + /** + * Spawns a powered minecart. + * + * @param loc + * @return + */ + public PoweredMinecart spawnPoweredMinecart(Location loc); } |