Merge pull request #1038 from Techlone/fix_assline_eu_production
Fix eu consumption absence by AssemblyLine and some clean up
This commit is contained in:
commit
77e1b53724
1 changed files with 149 additions and 96 deletions
|
@ -67,57 +67,60 @@ public class GT_MetaTileEntity_AssemblyLine
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkRecipe(ItemStack aStack) {
|
public boolean checkRecipe(ItemStack aStack) {
|
||||||
if(!GT_Utility.isStackValid(mInventory[1]) && !ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true))return false;
|
if (!GT_Utility.isStackValid(mInventory[1]) || !ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true))
|
||||||
|
return false;
|
||||||
|
|
||||||
NBTTagCompound tTag = mInventory[1].getTagCompound();
|
NBTTagCompound tTag = mInventory[1].getTagCompound();
|
||||||
if (tTag == null) return false;
|
if (tTag == null) return false;
|
||||||
ItemStack tStack[] = new ItemStack[15];
|
ItemStack tStack[] = new ItemStack[15];
|
||||||
for (int i = 0; i < 15; i++) {
|
for (int i = 0; i < 15; i++) {
|
||||||
if(tTag.hasKey(""+i)){
|
if (!tTag.hasKey("" + i)) continue;
|
||||||
tStack[i] = GT_Utility.loadItem(tTag, ""+i);
|
|
||||||
if(tStack[i]!=null){
|
|
||||||
if (mInputBusses.get(i) == null) return false;
|
if (mInputBusses.get(i) == null) return false;
|
||||||
if(GT_Utility.areStacksEqual(tStack[i],mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0),true) && tStack[i].stackSize <= mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0).stackSize){
|
tStack[i] = GT_Utility.loadItem(tTag, "" + i);
|
||||||
}else{return false;}
|
if (tStack[i] == null) continue;
|
||||||
}}
|
ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
|
||||||
}
|
if (!GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) || tStack[i].stackSize > stackInSlot.stackSize) {
|
||||||
FluidStack[] tFluids = new FluidStack[4];
|
return false;
|
||||||
for(int i = 0;i<4;i++){
|
|
||||||
if(tTag.hasKey("f"+i)){
|
|
||||||
tFluids[i] = GT_Utility.loadFluid(tTag, "f"+i);
|
|
||||||
if(tFluids[i]!=null){
|
|
||||||
if(mInputHatches.get(i)==null)return false;
|
|
||||||
if(mInputHatches.get(i).mFluid!=null && GT_Utility.areFluidsEqual(mInputHatches.get(i).mFluid, tFluids[i], true) && mInputHatches.get(i).mFluid.amount>=tFluids[i].amount){
|
|
||||||
}else{return false;}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tTag.hasKey("output")){
|
|
||||||
mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
|
|
||||||
if(mOutputItems==null||mOutputItems[0]==null||!GT_Utility.isStackValid(mOutputItems[0]))return false;
|
|
||||||
}else{return false;}
|
|
||||||
if(tTag.hasKey("time")){
|
|
||||||
mMaxProgresstime = tTag.getInteger("time");
|
|
||||||
if(mMaxProgresstime<=0)return false;
|
|
||||||
}else{return false;}
|
|
||||||
if(tTag.hasKey("eu")){
|
|
||||||
mEUt = tTag.getInteger("eu");
|
|
||||||
}else{return false;}
|
|
||||||
for(int i = 0;i<15;i++){
|
|
||||||
if(tStack[i]!=null){
|
|
||||||
mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0).stackSize -= tStack[i].stackSize;
|
|
||||||
if(mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0).stackSize <= 0){
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluidStack[] tFluids = new FluidStack[4];
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if(tFluids[i]!=null){
|
if (!tTag.hasKey("f" + i)) continue;
|
||||||
|
tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
|
||||||
|
if (tFluids[i] == null) continue;
|
||||||
|
if (mInputHatches.get(i) == null) return false;
|
||||||
|
FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
|
||||||
|
if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tTag.hasKey("output")) return false;
|
||||||
|
mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
|
||||||
|
if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!tTag.hasKey("time")) return false;
|
||||||
|
mMaxProgresstime = tTag.getInteger("time");
|
||||||
|
if (mMaxProgresstime <= 0) return false;
|
||||||
|
|
||||||
|
if (!tTag.hasKey("eu")) return false;
|
||||||
|
mEUt = tTag.getInteger("eu");
|
||||||
|
for (int i = 0; i < 15; i++) {
|
||||||
|
if (tStack[i] == null) continue;
|
||||||
|
ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
|
||||||
|
stackInSlot.stackSize -= tStack[i].stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if (tFluids[i] == null) continue;
|
||||||
mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
|
mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
|
||||||
if (mInputHatches.get(i).mFluid.amount <= 0) {
|
if (mInputHatches.get(i).mFluid.amount <= 0) {
|
||||||
mInputHatches.get(i).mFluid = null;
|
mInputHatches.get(i).mFluid = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
|
byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
|
||||||
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
|
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
|
||||||
this.mEfficiencyIncrease = 10000;
|
this.mEfficiencyIncrease = 10000;
|
||||||
|
@ -130,6 +133,9 @@ public class GT_MetaTileEntity_AssemblyLine
|
||||||
this.mMaxProgresstime /= 2;
|
this.mMaxProgresstime /= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.mEUt > 0) {
|
||||||
|
this.mEUt = -this.mEUt;
|
||||||
|
}
|
||||||
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
|
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
|
||||||
updateSlots();
|
updateSlots();
|
||||||
return true;
|
return true;
|
||||||
|
@ -138,7 +144,7 @@ public class GT_MetaTileEntity_AssemblyLine
|
||||||
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
|
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
|
||||||
super.startSoundLoop(aIndex, aX, aY, aZ);
|
super.startSoundLoop(aIndex, aX, aY, aZ);
|
||||||
if (aIndex == 20) {
|
if (aIndex == 20) {
|
||||||
GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
|
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,68 +155,114 @@ public class GT_MetaTileEntity_AssemblyLine
|
||||||
for (int r = 0; r <= 16; r++) {
|
for (int r = 0; r <= 16; r++) {
|
||||||
int i = r * xDir;
|
int i = r * xDir;
|
||||||
|
|
||||||
if(i!=0&& !(aBaseMetaTileEntity.getBlockOffset(0, 0, i)==GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(0, 0, i)==10)){return false;}
|
if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(0, 0, i) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(0, 0, i) == 10)) {
|
||||||
if(!aBaseMetaTileEntity.getBlockOffset(0, -1, i).getUnlocalizedName().equals("blockAlloyGlass")){return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (!aBaseMetaTileEntity.getBlockOffset(0, -1, i).getUnlocalizedName().equals("blockAlloyGlass")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, -2, i);
|
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, -2, i);
|
||||||
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
||||||
if (aBaseMetaTileEntity.getBlockOffset(0, -2, i) != GregTech_API.sBlockCasings2) {return false;}
|
if (aBaseMetaTileEntity.getBlockOffset(0, -2, i) != GregTech_API.sBlockCasings2) {
|
||||||
if (aBaseMetaTileEntity.getMetaIDOffset(0, -2, i) != 0) {return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (aBaseMetaTileEntity.getMetaIDOffset(0, -2, i) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 1, i);
|
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 1, i);
|
||||||
if (!addEnergyInputToMachineList(tTileEntity, 16)) {
|
if (!addEnergyInputToMachineList(tTileEntity, 16)) {
|
||||||
if (aBaseMetaTileEntity.getBlockOffset(xDir, 1, i) != GregTech_API.sBlockCasings2) {return false;}
|
if (aBaseMetaTileEntity.getBlockOffset(xDir, 1, i) != GregTech_API.sBlockCasings2) {
|
||||||
if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 1, i) != 0) {return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 1, i) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(xDir, 0, i) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, i) == 9)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(xDir, -1, i) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, i) == 5)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if(i!=0&& !(aBaseMetaTileEntity.getBlockOffset(xDir, 0, i)==GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, i)==9)){return false;}
|
|
||||||
if(i!=0&& !(aBaseMetaTileEntity.getBlockOffset(xDir,-1, i)==GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(xDir,-1, i)==5)){return false;}
|
|
||||||
|
|
||||||
|
|
||||||
if(!(aBaseMetaTileEntity.getBlockOffset(xDir*2, 0, i)==GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(xDir*2, 0, i)==10)){return false;}
|
if (!(aBaseMetaTileEntity.getBlockOffset(xDir * 2, 0, i) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, 0, i) == 10)) {
|
||||||
if(!aBaseMetaTileEntity.getBlockOffset(xDir*2, -1, i).getUnlocalizedName().equals("blockAlloyGlass")){return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (!aBaseMetaTileEntity.getBlockOffset(xDir * 2, -1, i).getUnlocalizedName().equals("blockAlloyGlass")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir * 2, -2, i);
|
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir * 2, -2, i);
|
||||||
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
||||||
if (aBaseMetaTileEntity.getBlockOffset(xDir*2, -2, i) != GregTech_API.sBlockCasings2) {return false;}
|
if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -2, i) != GregTech_API.sBlockCasings2) {
|
||||||
if (aBaseMetaTileEntity.getMetaIDOffset(xDir*2, -2, i) != 0) {return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -2, i) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i);
|
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i);
|
||||||
if (!addInputToMachineList(tTileEntity, 16)){
|
if (!addInputToMachineList(tTileEntity, 16) && addOutputToMachineList(tTileEntity, 16)) {
|
||||||
if (!addOutputToMachineList(tTileEntity, 16)){
|
return r > 0 && mEnergyHatches.size() > 0;
|
||||||
}else{if(r>0){return mEnergyHatches.size()>0;}else{return false;}}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int r = 0; r <= 16; r++) {
|
for (int r = 0; r <= 16; r++) {
|
||||||
int i = r * -zDir;
|
int i = r * -zDir;
|
||||||
|
|
||||||
if(i!=0 && !(aBaseMetaTileEntity.getBlockOffset(i, 0, 0)==GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0)==10)){return false;}
|
if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(i, 0, 0) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0) == 10)) {
|
||||||
if(!aBaseMetaTileEntity.getBlockOffset(i, -1, 0).getUnlocalizedName().equals("blockAlloyGlass")){return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (!aBaseMetaTileEntity.getBlockOffset(i, -1, 0).getUnlocalizedName().equals("blockAlloyGlass")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, 0);
|
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, 0);
|
||||||
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
||||||
if (aBaseMetaTileEntity.getBlockOffset(i, -2, 0) != GregTech_API.sBlockCasings2) {return false;}
|
if (aBaseMetaTileEntity.getBlockOffset(i, -2, 0) != GregTech_API.sBlockCasings2) {
|
||||||
if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, 0) != 0) {return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, 0) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 1, zDir);
|
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 1, zDir);
|
||||||
if (!addEnergyInputToMachineList(tTileEntity, 16)) {
|
if (!addEnergyInputToMachineList(tTileEntity, 16)) {
|
||||||
if (aBaseMetaTileEntity.getBlockOffset(i, 1, zDir) != GregTech_API.sBlockCasings2) {return false;}
|
if (aBaseMetaTileEntity.getBlockOffset(i, 1, zDir) != GregTech_API.sBlockCasings2) {
|
||||||
if (aBaseMetaTileEntity.getMetaIDOffset(i, 1, zDir) != 0) {return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (aBaseMetaTileEntity.getMetaIDOffset(i, 1, zDir) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(i, 0, zDir) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir) == 9)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(i, -1, zDir) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir) == 5)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if(i!=0&& !(aBaseMetaTileEntity.getBlockOffset(i, 0, zDir)==GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir)==9)){return false;}
|
|
||||||
if(i!=0&& !(aBaseMetaTileEntity.getBlockOffset(i,-1, zDir)==GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(i,-1, zDir)==5)){return false;}
|
|
||||||
|
|
||||||
|
|
||||||
if(!(aBaseMetaTileEntity.getBlockOffset(i, 0, zDir*2)==GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir*2)==10)){return false;}
|
if (!(aBaseMetaTileEntity.getBlockOffset(i, 0, zDir * 2) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir * 2) == 10)) {
|
||||||
if(!aBaseMetaTileEntity.getBlockOffset(i, -1, zDir*2).getUnlocalizedName().equals("blockAlloyGlass")){return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (!aBaseMetaTileEntity.getBlockOffset(i, -1, zDir * 2).getUnlocalizedName().equals("blockAlloyGlass")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir * 2);
|
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir * 2);
|
||||||
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
|
||||||
if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir*2) != GregTech_API.sBlockCasings2) {return false;}
|
if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir * 2) != GregTech_API.sBlockCasings2) {
|
||||||
if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir*2) != 0) {return false;}
|
return false;
|
||||||
|
}
|
||||||
|
if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir * 2) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir);
|
tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir);
|
||||||
if (!addInputToMachineList(tTileEntity, 16)){
|
if (!addInputToMachineList(tTileEntity, 16) && addOutputToMachineList(tTileEntity, 16)) {
|
||||||
if (!addOutputToMachineList(tTileEntity, 16)){
|
return r > 0 && mEnergyHatches.size() > 0;
|
||||||
}else{if(r>0){return mEnergyHatches.size()>0;}else{return false;}}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,6 +280,7 @@ public class GT_MetaTileEntity_AssemblyLine
|
||||||
public int getDamageToComponent(ItemStack aStack) {
|
public int getDamageToComponent(ItemStack aStack) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean explodesOnComponentBreak(ItemStack aStack) {
|
public boolean explodesOnComponentBreak(ItemStack aStack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue