abstracted out side buttons (thanks to this they also work on ctrls now)

This commit is contained in:
Raoul Van den Berge
2015-12-20 16:43:56 +01:00
parent d57618f990
commit 23a9b358bf
18 changed files with 322 additions and 158 deletions

View File

@@ -1,10 +1,14 @@
package storagecraft.tile;
import net.minecraft.world.World;
public enum RedstoneMode {
IGNORE(0),
HIGH(1),
LOW(2);
public static final String NBT = "RedstoneMode";
public final int id;
RedstoneMode(int id) {
@@ -21,6 +25,19 @@ public enum RedstoneMode {
return next;
}
public boolean isEnabled(World world, int x, int y, int z) {
switch (this) {
case IGNORE:
return true;
case HIGH:
return world.isBlockIndirectlyGettingPowered(x, y, z);
case LOW:
return !world.isBlockIndirectlyGettingPowered(x, y, z);
}
return false;
}
public static RedstoneMode getById(int id) {
for (RedstoneMode control : values()) {
if (control.id == id) {