RedstoneTorch MaterialData + Redstone interface

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-01-15 20:30:27 +00:00
parent da00145da7
commit 7314f0ade2
2 changed files with 50 additions and 0 deletions

View file

@ -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();
}

View file

@ -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;
}
}