From da00145da7b4b3981f06722ab40365a2ca5f1b4b Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 15 Jan 2011 20:30:13 +0000 Subject: [PATCH] Added Torches By: Dinnerbone --- .../main/java/org/bukkit/material/Torch.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/material/Torch.java diff --git a/paper-api/src/main/java/org/bukkit/material/Torch.java b/paper-api/src/main/java/org/bukkit/material/Torch.java new file mode 100644 index 0000000000..0405d18edd --- /dev/null +++ b/paper-api/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; + } +}