Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Mar 2, 2025
1 parent 4d04bb6 commit f742a07
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,11 @@ public void program() {
try {

for (IAEItemStack s : getProxy().getStorage().getItemInventory().getStorageList()) {
if(s==null)continue;
if(!(s.getItem() instanceof ItemProgrammingCircuit)){
continue;
}

IAEItemStack ext = getProxy().getStorage().getItemInventory().extractItems(s, Actionable.MODULATE,
getRequestSource());
if (ext != null && ext.getStackSize() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.lang.invoke.MethodType;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
Expand All @@ -16,6 +17,7 @@
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.MTEMultiBlockBase;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.util.GTUtility;
import gregtech.common.tileentities.machines.IDualInputHatch;
import reobf.proghatches.gt.metatileentity.util.IRecipeProcessingAwareDualHatch;

Expand All @@ -37,6 +39,12 @@ public abstract class MixinAwarenessForDualHatch {
// @Shadow
// public abstract void setResultIfFailure(CheckRecipeResult result) ;


private MTEMultiBlockBase cast(){
Object o=this;
return (MTEMultiBlockBase) o;
}
/*
@Unique
private static MethodHandle MH_mDualInputHatches;
@Unique
Expand Down Expand Up @@ -79,20 +87,21 @@ private ArrayList<IDualInputHatch> mDualInputHatches0() {
throw new AssertionError(e);
}
}

*/






@Inject(method = "startRecipeProcessing", at = { @At(value = "RETURN") } ,require=1 )
public void startRecipeProcessing(CallbackInfo c) {
ArrayList<IDualInputHatch> collection = mDualInputHatches0();
Iterator<IDualInputHatch> it = collection.iterator();
while (it.hasNext()) {
IDualInputHatch hatch = it.next();
if (hatch == null) continue;
if (!((MetaTileEntity) hatch).isValid()) {
if (hatch instanceof IRecipeProcessingAwareDualHatch) {
it.remove();
}
continue;
}


@SuppressWarnings({ "unchecked", "rawtypes" })
List<IDualInputHatch> l=(List<IDualInputHatch>)(List) GTUtility.validMTEList((List<MetaTileEntity>)(Object)(cast().mDualInputHatches));
for (IDualInputHatch hatch:l) {

if (hatch instanceof IRecipeProcessingAwareDualHatch) {
((IRecipeProcessingAwareDualHatch) hatch).startRecipeProcessing();
}
Expand All @@ -106,10 +115,10 @@ public void endRecipeProcessing(CallbackInfo c) {
* (!result.wasSuccessful()) { this.checkRecipeResult = result; } };
*/

for (IDualInputHatch hatch : (mDualInputHatches0())) {
for (IDualInputHatch hatch : (cast().mDualInputHatches)) {
if (hatch == null || !((MetaTileEntity) hatch).isValid()) continue;
if (hatch instanceof IRecipeProcessingAwareDualHatch) {
setResultIfFailure0(
cast().setResultIfFailure(
((IRecipeProcessingAwareDualHatch) hatch).endRecipeProcessing((MTEMultiBlockBase) (Object) this));
}
}
Expand Down

0 comments on commit f742a07

Please sign in to comment.