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

103 lines
2.6 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_RedstoneMeter
extends GT_CircuitryBehavior
{
public GT_Circuit_RedstoneMeter(int aIndex)
{
super(aIndex);
}
public void initParameters(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock)
{
aCircuitData[0] = 1;
aCircuitData[1] = 15;
aCircuitData[2] = 0;
aCircuitData[3] = 15;
}
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[1] = 0;
}
if (aCircuitData[1] > 15) {
aCircuitData[1] = 15;
}
if (aCircuitData[1] < aCircuitData[0]) {
aCircuitData[1] = aCircuitData[0];
}
if (aCircuitData[2] < 0) {
aCircuitData[2] = 0;
}
if (aCircuitData[2] > 1) {
aCircuitData[2] = 1;
}
if (aCircuitData[3] < 0) {
aCircuitData[3] = 0;
}
if (aCircuitData[3] > 15) {
aCircuitData[3] = 15;
}
}
public void onTick(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock)
{
byte tRedstone = getStrongestRedstone(aRedstoneCircuitBlock);
aRedstoneCircuitBlock.setRedstone((byte)(((tRedstone >= aCircuitData[0]) && (tRedstone <= aCircuitData[1]) ? 1 : 0) != (aCircuitData[2] != 0 ? 1 : 0) ? (byte)aCircuitData[3] : 0), aRedstoneCircuitBlock.getOutputFacing());
}
public String getName()
{
return "Redstone Meter";
}
public String getDescription()
{
return "Checks Boundaries";
}
public String getDataDescription(int[] aCircuitData, int aCircuitDataIndex)
{
switch (aCircuitDataIndex)
{
case 0:
return "Lower";
case 1:
return "Upper";
case 2:
return "Invert:";
case 3:
return "RS Out:";
}
return "";
}
public boolean displayItemStack(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock, int aIndex)
{
return false;
}
public String getDataDisplay(int[] aCircuitData, int aCircuitDataIndex)
{
if (aCircuitDataIndex == 2) {
return aCircuitData[2] == 0 ? "OFF" : "ON";
}
return null;
}
}
2015-04-23 16:14:22 +00:00
/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar
* Qualified Name: gregtech.common.redstonecircuits.GT_Circuit_RedstoneMeter
* JD-Core Version: 0.7.0.1
*/