Skip to content

Commit

Permalink
Allow Accessing Virtualized from GT RecipeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Jan 10, 2025
1 parent 75bd266 commit 4869720
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -28,16 +30,20 @@
import gregtech.api.recipes.chance.output.impl.ChancedFluidOutput;
import gregtech.api.recipes.chance.output.impl.ChancedItemOutput;
import gregtech.api.util.ValidationResult;
import gregtech.integration.groovy.VirtualizedRecipeMap;

/**
* Allows for lookup with outputs.
* Allows for lookup with outputs. Allows accessing Virtualized Recipe Map.
* <p>
* Precaution to make sure only Recycling Recipes are added during recycling recipe reloading.<br>
* This is because Arc Smelting sometimes generates non-recycling recipes.
*/
@Mixin(value = RecipeMap.class, remap = false)
public abstract class RecipeMapMixin implements AccessibleRecipeMap {

@Shadow
@Final
private Object grsVirtualizedRecipeMap;
@Unique
private final OutputBranch outputLookup = new OutputBranch();

Expand Down Expand Up @@ -110,4 +116,10 @@ public List<Recipe> findRecipeByOutput(long voltage, List<ItemStack> inputs, Lis
return recipe.getEUt() <= voltage;
});
}

@Unique
@SuppressWarnings("unused")
public VirtualizedRecipeMap getVirtualized() {
return (VirtualizedRecipeMap) grsVirtualizedRecipeMap;
}
}

0 comments on commit 4869720

Please sign in to comment.