Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Feb 26, 2024
1 parent 7bb3ebe commit 7fbc95e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1419,14 +1419,11 @@ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlaye
return super.onRightclick(aBaseMetaTileEntity, aPlayer);
}

@Override
public void startRecipeProcessing() {

}

@Override
public CheckRecipeResult endRecipeProcessing(GT_MetaTileEntity_MultiBlockBase controller) {
dirty=true;
return CheckRecipeResultRegistry.SUCCESSFUL;
return super.endRecipeProcessing(controller);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_TooltipDataCache;
import gregtech.api.util.extensions.ArrayExt;
Expand All @@ -62,7 +65,7 @@
import reobf.proghatches.main.registration.Registration;

public class DualInputHatch extends GT_MetaTileEntity_Hatch_InputBus implements IConfigurationCircuitSupport,
IAddGregtechLogo, IAddUIWidgets, IDualInputHatch, IProgrammingCoverBlacklisted {
IAddGregtechLogo, IAddUIWidgets, IDualInputHatch, IProgrammingCoverBlacklisted, IRecipeProcessingAwareDualHatch {

static java.text.DecimalFormat format = new java.text.DecimalFormat("#,###");
public boolean mMultiFluid;
Expand Down Expand Up @@ -299,6 +302,9 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) {
* position=new Pos2d(position.getX(),position.getY()).add(0, 18);
* }
*/



}

@Override
Expand Down Expand Up @@ -560,14 +566,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {


if (program) program();
if (aBaseMetaTileEntity.isServerSide()) {
for (int i = 0; i < getMaxType(); i++) {
if (mStoredFluid[i].getFluid() != null && mStoredFluid[i].getFluidAmount() <= 0) {
mStoredFluid[i].setFluid(null);
markDirty();
}
}
}


}

Expand Down Expand Up @@ -804,6 +803,30 @@ public int fluidSlotsPerRow() {
return 1;
}

@Override
public void startRecipeProcessing() {


}
@Override
public void updateSlots() {
if (this.getBaseMetaTileEntity().isServerSide()) {
for (int i = 0; i < getMaxType(); i++) {
if (mStoredFluid[i].getFluid() != null && mStoredFluid[i].getFluidAmount() <= 0) {
mStoredFluid[i].setFluid(null);

}
}
}
super.updateSlots();
}
@Override
public CheckRecipeResult endRecipeProcessing(GT_MetaTileEntity_MultiBlockBase controller) {
this.markDirty();
updateSlots();
return CheckRecipeResultRegistry.SUCCESSFUL;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public List<String> getMixins() {


ArrayList<String> ret = new ArrayList<>();

ret.add("MixinAwarenessForDualHatch");
if(!"true".equals(pp.get("noRemoveUnusedCacheInModularUIContainer")))
ret.add("MixinRemoveUnunsedItemStackCache");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
Expand All @@ -38,6 +39,7 @@ public abstract class MixinAwarenessForDualHatch {
@Inject( method = "startRecipeProcessing",at = { @At(value = "RETURN") })
public void a(CallbackInfo c){
for (IDualInputHatch hatch :(mDualInputHatches)) {
if(hatch==null||!((MetaTileEntity) hatch).isValid())continue;
if (hatch instanceof IRecipeProcessingAwareDualHatch ) {
((IRecipeProcessingAwareDualHatch) hatch).startRecipeProcessing();
}
Expand All @@ -55,6 +57,7 @@ public void b(CallbackInfo c){
};

for (IDualInputHatch hatch : (mDualInputHatches)) {
if(hatch==null||!((MetaTileEntity) hatch).isValid())continue;
if (hatch instanceof IRecipeProcessingAwareDualHatch) {
setResultIfFailure.accept(((IRecipeProcessingAwareDualHatch)hatch).endRecipeProcessing(
(GT_MetaTileEntity_MultiBlockBase)(Object)this
Expand Down

0 comments on commit 7fbc95e

Please sign in to comment.