mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-18 11:29:30 +00:00
51 lines
1.2 KiB
Java
51 lines
1.2 KiB
Java
package crazypants.enderio.machine;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import crazypants.util.Lang;
|
|
|
|
public enum RedstoneControlMode {
|
|
|
|
IGNORE,
|
|
ON,
|
|
OFF,
|
|
NEVER;
|
|
|
|
RedstoneControlMode() {
|
|
}
|
|
|
|
public String getTooltip() {
|
|
return Lang.localize("gui.tooltip.redstoneControlMode." + name().toLowerCase());
|
|
}
|
|
|
|
public static boolean isConditionMet(RedstoneControlMode redstoneControlMode, int powerLevel) {
|
|
boolean redstoneCheckPassed = true;
|
|
if(redstoneControlMode == RedstoneControlMode.NEVER) {
|
|
redstoneCheckPassed = false;
|
|
} else if(redstoneControlMode == RedstoneControlMode.ON) {
|
|
if(powerLevel < 1) {
|
|
redstoneCheckPassed = false;
|
|
}
|
|
} else if(redstoneControlMode == RedstoneControlMode.OFF) {
|
|
if(powerLevel > 0) {
|
|
redstoneCheckPassed = false;
|
|
}
|
|
}
|
|
return redstoneCheckPassed;
|
|
}
|
|
|
|
public static boolean isConditionMet(RedstoneControlMode redstoneControlMode, TileEntity te) {
|
|
return isConditionMet(redstoneControlMode, te.worldObj.getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
|
|
}
|
|
|
|
public RedstoneControlMode next() {
|
|
int ord = ordinal();
|
|
if(ord == values().length - 1) {
|
|
ord = 0;
|
|
} else {
|
|
ord++;
|
|
}
|
|
return values()[ord];
|
|
}
|
|
|
|
}
|