From 7314f0ade22f31a65cd3656470b9b5fca813ffb8 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 15 Jan 2011 20:30:27 +0000 Subject: [PATCH] RedstoneTorch MaterialData + Redstone interface By: Dinnerbone --- .../java/org/bukkit/material/Redstone.java | 15 ++++++++ .../org/bukkit/material/RedstoneTorch.java | 35 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/material/Redstone.java create mode 100644 paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java diff --git a/paper-api/src/main/java/org/bukkit/material/Redstone.java b/paper-api/src/main/java/org/bukkit/material/Redstone.java new file mode 100644 index 0000000000..295fb02b6c --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/material/Redstone.java @@ -0,0 +1,15 @@ + +package org.bukkit.material; + +/** + * Indicated a Material that may carry or create a Redstone current + */ +public interface Redstone { + /** + * Gets the current state of this Material, indicating if it's powered or + * unpowered + * + * @return true if powered, otherwise false + */ + public boolean isPowered(); +} diff --git a/paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java b/paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java new file mode 100644 index 0000000000..04e5148dda --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/material/RedstoneTorch.java @@ -0,0 +1,35 @@ + +package org.bukkit.material; + +import org.bukkit.Material; + +/** + * Represents a redstone torch + */ +public class RedstoneTorch extends Torch implements Redstone { + public RedstoneTorch(final int type) { + super(type); + } + + public RedstoneTorch(final Material type) { + super(type); + } + + public RedstoneTorch(final int type, final byte data) { + super(type, data); + } + + public RedstoneTorch(final Material type, final byte data) { + super(type, data); + } + + /** + * Gets the current state of this Material, indicating if it's powered or + * unpowered + * + * @return true if powered, otherwise false + */ + public boolean isPowered() { + return getItemType() == Material.REDSTONE_TORCH_ON; + } +}