2015-06-23 22:29:05 +00:00
|
|
|
package gregtech.common.covers;
|
|
|
|
|
|
|
|
import gregtech.api.interfaces.tileentity.ICoverable;
|
|
|
|
import gregtech.api.interfaces.tileentity.IMachineProgress;
|
|
|
|
import gregtech.api.util.GT_CoverBehavior;
|
|
|
|
import gregtech.api.util.GT_Utility;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraftforge.fluids.Fluid;
|
|
|
|
|
|
|
|
public class GT_Cover_RedstoneSignalizer
|
2015-10-22 02:15:09 +00:00
|
|
|
extends GT_CoverBehavior {
|
|
|
|
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
|
|
|
|
aCoverVariable = (aCoverVariable + 1) % 48;
|
2015-10-25 13:27:29 +00:00
|
|
|
switch(aCoverVariable / 16) {
|
|
|
|
case 0: GT_Utility.sendChatToPlayer(aPlayer, "Signal = " + (aCoverVariable & 0xF)); break;
|
|
|
|
case 1: GT_Utility.sendChatToPlayer(aPlayer, "Conditional Signal = " + (aCoverVariable & 0xF)); break;
|
|
|
|
case 2: GT_Utility.sendChatToPlayer(aPlayer, "Inverted Conditional Signal = " + (aCoverVariable & 0xF)); break;
|
2015-10-22 02:15:09 +00:00
|
|
|
}
|
|
|
|
return aCoverVariable;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
|
|
|
|
return true;
|
2015-06-23 22:29:05 +00:00
|
|
|
}
|
2015-10-22 02:15:09 +00:00
|
|
|
|
|
|
|
public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
|
|
|
|
return true;
|
2015-06-23 22:29:05 +00:00
|
|
|
}
|
2015-10-22 02:15:09 +00:00
|
|
|
|
|
|
|
public byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
|
|
|
|
if (aCoverVariable < 16) {
|
|
|
|
return (byte) (aCoverVariable & 0xF);
|
|
|
|
}
|
|
|
|
if ((aTileEntity instanceof IMachineProgress)) {
|
|
|
|
if (((IMachineProgress) aTileEntity).isAllowedToWork()) {
|
|
|
|
if (aCoverVariable / 16 == 1) {
|
|
|
|
return (byte) (aCoverVariable & 0xF);
|
|
|
|
}
|
|
|
|
} else if (aCoverVariable / 16 == 2) {
|
|
|
|
return (byte) (aCoverVariable & 0xF);
|
|
|
|
}
|
|
|
|
return 0;
|
2015-06-23 22:29:05 +00:00
|
|
|
}
|
2015-10-22 02:15:09 +00:00
|
|
|
return (byte) (aCoverVariable & 0xF);
|
2015-06-23 22:29:05 +00:00
|
|
|
}
|
|
|
|
}
|