summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/bukkit/material/Torch.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/material/Torch.java b/src/main/java/org/bukkit/material/Torch.java
new file mode 100644
index 00000000..0405d18e
--- /dev/null
+++ b/src/main/java/org/bukkit/material/Torch.java
@@ -0,0 +1,50 @@
+
+package org.bukkit.material;
+
+import org.bukkit.BlockFace;
+import org.bukkit.Material;
+
+/**
+ * MaterialData for torches
+ */
+public class Torch extends MaterialData implements Attachable {
+ public Torch(final int type) {
+ super(type);
+ }
+
+ public Torch(final Material type) {
+ super(type);
+ }
+
+ public Torch(final int type, final byte data) {
+ super(type, data);
+ }
+
+ public Torch(final Material type, final byte data) {
+ super(type, data);
+ }
+
+ /**
+ * Gets the face that this block is attached on
+ *
+ * @return BlockFace attached to
+ */
+ public BlockFace getAttachedFace() {
+ byte data = getData();
+
+ switch (data) {
+ case 0x1:
+ return BlockFace.NORTH;
+ case 0x2:
+ return BlockFace.SOUTH;
+ case 0x3:
+ return BlockFace.EAST;
+ case 0x4:
+ return BlockFace.WEST;
+ case 0x5:
+ return BlockFace.DOWN;
+ }
+
+ return null;
+ }
+}