GT5-Unofficial/main/java/gregtech/common/redstonecircuits/GT_Circuit_Equals.java

76 lines
1.9 KiB
Java
Raw Normal View History

2015-06-23 22:29:05 +00:00
package gregtech.common.redstonecircuits;
import gregtech.api.interfaces.IRedstoneCircuitBlock;
import gregtech.api.util.GT_CircuitryBehavior;
public class GT_Circuit_Equals
extends GT_CircuitryBehavior
{
public GT_Circuit_Equals(int aIndex)
{
super(aIndex);
}
public void initParameters(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock)
{
aCircuitData[0] = 0;
aCircuitData[1] = 0;
}
public void validateParameters(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock)
{
if (aCircuitData[0] < 0) {
aCircuitData[0] = 0;
}
if (aCircuitData[0] > 15) {
aCircuitData[0] = 15;
}
if (aCircuitData[1] < 0) {
aCircuitData[3] = 0;
}
if (aCircuitData[1] > 1) {
aCircuitData[3] = 1;
}
}
public void onTick(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock)
{
aRedstoneCircuitBlock.setRedstone(((byte)((aCircuitData[1] != 0 ? getStrongestRedstone(aRedstoneCircuitBlock) == aCircuitData[0] : getStrongestRedstone(aRedstoneCircuitBlock) != aCircuitData[0]) ? 0 : 15)), aRedstoneCircuitBlock.getOutputFacing());
}
2015-06-23 22:29:05 +00:00
public String getName()
{
return "Equals";
}
public String getDescription()
{
return "signal == this";
}
public String getDataDescription(int[] aCircuitData, int aCircuitDataIndex)
{
switch (aCircuitDataIndex)
{
case 0:
return "Signal";
case 1:
return aCircuitData[1] == 0 ? "Equal" : "Unequal";
}
return "";
}
public boolean displayItemStack(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock, int aIndex)
{
return false;
}
public String getDataDisplay(int[] aCircuitData, int aCircuitDataIndex)
{
if (aCircuitDataIndex > 0) {
return "";
}
return null;
}
}