Auto Maintainance fix
This commit is contained in:
parent
1f64005592
commit
ed724da44d
2 changed files with 5 additions and 16 deletions
|
@ -30,7 +30,6 @@ import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch {
|
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 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) {
|
public GT_MetaTileEntity_Hatch_Maintenance(int aID, String aName, String aNameRegional, int aTier) {
|
||||||
super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks");
|
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);
|
return new GT_GUIContainer_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean autoMaintainance() {
|
||||||
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){
|
|
||||||
boolean tSuccess = true;
|
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)};
|
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);
|
List<ItemStack> aInputs = Arrays.asList(mInventory);
|
||||||
|
@ -161,11 +157,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
|
||||||
this.mScrewdriver = true;
|
this.mScrewdriver = true;
|
||||||
this.mSoftHammer = true;
|
this.mSoftHammer = true;
|
||||||
this.mSolderingTool = true;
|
this.mSolderingTool = true;
|
||||||
this.mWrench = true;
|
this.mWrench = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
}
|
|
||||||
super.onPostTick(aBaseMetaTileEntity, aTimer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) {
|
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) {
|
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setController(GT_MetaTileEntity_MultiBlockBase aController){
|
|
||||||
mController = aController;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
|
||||||
for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) {
|
for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) {
|
||||||
if (isValidMetaTileEntity(tHatch)) {
|
if (isValidMetaTileEntity(tHatch)) {
|
||||||
if (!this.disableMaintenance) {
|
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.mWrench) mWrench = true;
|
||||||
if (tHatch.mScrewdriver) mScrewdriver = true;
|
if (tHatch.mScrewdriver) mScrewdriver = true;
|
||||||
if (tHatch.mSoftHammer) mSoftHammer = true;
|
if (tHatch.mSoftHammer) mSoftHammer = true;
|
||||||
|
@ -714,8 +714,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
|
||||||
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
|
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
|
||||||
if (aMetaTileEntity == null) return false;
|
if (aMetaTileEntity == null) return false;
|
||||||
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
|
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 mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue