diff options
author | repo-alt <wvk17@yandex.ru> | 2022-08-19 19:22:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-19 18:22:17 +0200 |
commit | 77f5016dd0e198724a31a77e334ca069199eacdb (patch) | |
tree | 96a09fa4da882b04bffa504d63dea98f7a20bcc6 /src/main/java/gregtech/api/metatileentity/implementations | |
parent | 976c03c765e679cec496597255b1b5dd0fcd6a3e (diff) | |
download | GT5-Unofficial-77f5016dd0e198724a31a77e334ca069199eacdb.tar.gz GT5-Unofficial-77f5016dd0e198724a31a77e334ca069199eacdb.tar.bz2 GT5-Unofficial-77f5016dd0e198724a31a77e334ca069199eacdb.zip |
ME input bus, gives the multiblock direct access to the 16 selected item types (#1271)
* ME input bus, gives the multiblock direct access to the 16 selected item types
* Reworked GUI to match the normal interface
* Don't need to duplicate shadow slots
Sync can (better) be done in `endRecipeProcessing`, in case some multi doesn't call `updateSlots` or does it at the wrong time
* Clarify name, to distinguish from the (future) Buffering and Crafting buses
* Make the GUI 4x4 again
* Make the 4x4 GUI actually work
* Make ghost item show item amount
* Remove unimplemented code remnants
Co-authored-by: Sampsa <sampo.vanninen@aalto.fi>
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/implementations')
3 files changed, 37 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java index 6d99a24347..82dbc3afd9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java @@ -179,4 +179,6 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan } //To change to other page -> use the setter method -> updateTexture + + public int getCircuitSlot() { return -1; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index 039c35c268..fb5eec7880 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -1,5 +1,6 @@ package gregtech.api.metatileentity.implementations; +import appeng.util.Platform; import gregtech.GT_Mod; import gregtech.api.gui.*; import gregtech.api.interfaces.ITexture; @@ -34,6 +35,10 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { this(id, name, nameRegional, tier, getSlots(tier)); } + protected GT_MetaTileEntity_Hatch_InputBus(int id, String name, String nameRegional, int tier, int slots, String[] description) { + super(id, name, nameRegional, tier, slots, description); + } + public GT_MetaTileEntity_Hatch_InputBus(int id, String name, String nameRegional, int tier, int slots) { super(id, name, nameRegional, tier, slots, ArrayExt.of( "Item Input for Multiblocks", @@ -248,4 +253,10 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { return i == aIndex; return mInventory[aIndex] == null; } + + public void startRecipeProcessing() { + } + + public void endRecipeProcessing() { + } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index a31be046b3..e29499b0b1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -350,6 +350,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } } + protected boolean checkRecipe() + { + startRecipeProcessing(); + boolean result = checkRecipe(mInventory[1]); + endRecipeProcessing(); + return result; + } + protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { if (onRunningTick(mInventory[1])) { @@ -375,7 +383,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mProgresstime = 0; mMaxProgresstime = 0; mEfficiencyIncrease = 0; - if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); + if (aBaseMetaTileEntity.isAllowedToWork()) { + checkRecipe(); + } if (mOutputFluids != null && mOutputFluids.length > 0) { if (mOutputFluids.length > 1) { try { @@ -390,7 +400,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (aBaseMetaTileEntity.isAllowedToWork()) { - if(checkRecipe(mInventory[1])) { + if (checkRecipe()) { markDirty(); } } @@ -906,6 +916,18 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); } + protected void startRecipeProcessing() + { + for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) + if (isValidMetaTileEntity(tHatch)) tHatch.startRecipeProcessing(); + } + + protected void endRecipeProcessing() + { + for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) + if (isValidMetaTileEntity(tHatch)) tHatch.endRecipeProcessing(); + } + protected static <T extends GT_MetaTileEntity_Hatch> T identifyHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex, Class<T> clazz) { if (aTileEntity == null) return null; IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); |