use of buildcraft.core.statements.StatementParameterRedstoneLevel in project BuildCraft by BuildCraft.
the class TriggerRedstoneFaderInput method isTriggerActive.
@Override
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
if (!(container instanceof IGate) || parameters.length < 1 || !(parameters[0] instanceof StatementParameterRedstoneLevel)) {
return false;
}
int level = ((StatementParameterRedstoneLevel) parameters[0]).level;
IGate gate = (IGate) container;
TileGenericPipe tile = (TileGenericPipe) gate.getPipe().getTile();
int inputLevel = tile.redstoneInput;
if (parameters.length > 1 && parameters[1] instanceof StatementParamGateSideOnly && ((StatementParamGateSideOnly) parameters[1]).isOn) {
inputLevel = tile.redstoneInputSide[gate.getSide().ordinal()];
}
switch(mode) {
case LESS:
return inputLevel < level;
case EQUAL:
default:
return inputLevel == level;
case GREATER:
return inputLevel > level;
}
}
Aggregations