Update GT_MetaTileEntity_AssemblyLine.java

This commit is contained in:
Antifluxfield 2017-06-30 08:24:35 +08:00 committed by GitHub
parent 9ba12192c8
commit b1a29c3a22

View file

@ -21,6 +21,9 @@ import net.minecraftforge.fluids.FluidStack;
public class GT_MetaTileEntity_AssemblyLine
extends GT_MetaTileEntity_MultiBlockBase {
public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
public GT_MetaTileEntity_AssemblyLine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@ -312,6 +315,47 @@ public class GT_MetaTileEntity_AssemblyLine
}
return false;
}
/**
* @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
*/
private boolean isCorrectDataItem(ItemStack aStack, int state){
if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, false, true)) return true;
if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
return false;
}
/**
* @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
*/
public ArrayList<ItemStack> getDataItems(byte state) {
ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
rList.add(mInventory[1]);
}
for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
if (isValidMetaTileEntity(tHatch)) {
for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
&& isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
}
}
}
return rList;
}
public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) return false;
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
}
return false;
}
public int getMaxEfficiency(ItemStack aStack) {
return 10000;