Auto Maintainance fix

This commit is contained in:
Blood-Asp 2016-10-27 22:24:41 +02:00
parent 1f64005592
commit ed724da44d
2 changed files with 5 additions and 16 deletions

View file

@ -30,7 +30,6 @@ import scala.actors.threadpool.Arrays;
public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch {
public boolean mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mAuto;
public GT_MetaTileEntity_MultiBlockBase mController = null;
public GT_MetaTileEntity_Hatch_Maintenance(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks");
@ -113,10 +112,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
return new GT_GUIContainer_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
if (aBaseMetaTileEntity.isServerSide() && aTimer % 100 == 0 && mController != null) {
if(!mController.mCrowbar || !mController.mHardHammer || !mController.mScrewdriver || !mController.mSoftHammer || !mController.mSolderingTool || !mController.mWrench){
public boolean autoMaintainance() {
boolean tSuccess = true;
ItemStack[] mInputs = new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}),GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2),GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4),GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)};
List<ItemStack> aInputs = Arrays.asList(mInventory);
@ -161,11 +157,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
this.mScrewdriver = true;
this.mSoftHammer = true;
this.mSolderingTool = true;
this.mWrench = true;
this.mWrench = true;
return true;
}
}
}
super.onPostTick(aBaseMetaTileEntity, aTimer);
return false;
}
public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) {
@ -201,8 +196,4 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
public void setController(GT_MetaTileEntity_MultiBlockBase aController){
mController = aController;
}
}

View file

@ -206,7 +206,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) {
if (isValidMetaTileEntity(tHatch)) {
if (!this.disableMaintenance) {
tHatch.setController((GT_MetaTileEntity_MultiBlockBase) aBaseMetaTileEntity);
if(tHatch.mAuto && (!mWrench||!mScrewdriver||!mSoftHammer||!mHardHammer||!mSolderingTool||!mCrowbar))tHatch.autoMaintainance();
if (tHatch.mWrench) mWrench = true;
if (tHatch.mScrewdriver) mScrewdriver = true;
if (tHatch.mSoftHammer) mSoftHammer = true;
@ -714,8 +714,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity).setController((GT_MetaTileEntity_MultiBlockBase) aTileEntity);
return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
}
return false;