Skip to content

Commit

Permalink
Refactor RecipeMap (#2345)
Browse files Browse the repository at this point in the history
* Remove deprecated and unused things

* Move recipemap subclasses

* Move GT_Recipe_Map to outside and rename to RecipeMap

* Move recipemap instances to separated class & remove prepending s

* Remove useless GT_Recipe constructors

* Always use ModularUI

* Rename IGT_RecipeMap -> IRecipeMap

* Add RecipeMapBuilder

* Remove more deprecated and unused things

* Fix RecipeMap type parameters

* Use multimap for recipe index

* Fix bending recipe error in dev env

* Remove mUniqueIdentifier

* Update AE2FC

* Less edgy texture for NEI recipe background

* Add replicator fluid output slot for NEI and machine GUI

* Fix fluid fuels not having fuel value in large boilers

* Remove GT_RectHandler and NEI_TransferRectHost

* Remove RecipeMapHandler

* Move NEI energy description from RecipeMapFrontend to Power

* Refactor the way to filter fusion recipes

* Check restriction for some properties

* Remove showVoltageAmperage

* Make Power accept GT_Recipe

* Fix NPE

* Move NEI duration description to Power from Frontend

* Directly implement IRecipeProcessingAwareHatch for GT_MetaTileEntity_Hatch_InputBus_ME

* Make Power integrated with GT_OverclockCalculator

* Rename Power -> OverclockDescriber

* Don't modify recipe find logic until postload finishes

* Reformat reserved MTE ids

* Fix check for too few inputs on recipe addition

* Move replicator logic to backend

* Stop un-hiding assline recipes

* Allow setting custom recipe comparator & implement for fusion

* Update AE2FC

* Rename getRecipeList and getRecipes -> getRecipeMap

* Automatically register recipe catalysts

* Cleanup the way to detect recipe collision

* Make use of BasicUIProperties for basic machines

* Make use of BasicUIProperties for UIHelper

* Rename specialHandler -> recipeTransformer

* Add way to automatically register handler info

* Add recipe category

* Add some APIs for addons

* Rename blastRecipes ->
blastFurnaceRecipes

* Remove GT_MetaTileEntity_BasicMachine_GT_Recipe#mSharedTank and #mRequiresFluidForFiltering

* Don't require setting duration and EU/t for fuel recipes

* Don't require setting EU/t for primitive blast furnace recipes

* Revert change to addMultiblockChemicalRecipe

* Fix large boiler general desc recipe not being added

* Hide duration and EU/t from large boiler

* Cleanup recipe stacktrace draw

* Extend metadata usage of recipe builder to recipe itself

* Implement metadata handling & NEI comparator for PCB factory

* Some rename around NEIRecipeInfo

* Some toString implementations

* Add more APIs for addons & some rename

* Infer handler icon from recipe catalyst if one is not set

* Also shrink recipe title when OC is not used

* Remove rare earth centrifuge recipe

* Use metadata for replicator backend

* Adjust geothermal generator output slot

* Allow having multiple transferrects

* Store recipemap reference in backend

* Rename vacuumRecipes -> vacuumFreezerRecipes

* Add config to tweak visibility of recipe categories

* Remove mHideRecyclingRecipes in favor of recipe category config

* Fix typo fluidSolidfierRecipes -> fluidSolidifierRecipes

* Refactor findRecipe and ProcessingLogic to use Stream

* Fix BBF handler icon & remove bronze blast furnace

* Add fluent API for findRecipe

* Add way to stop adding progressbar

* Change arg order for special texture

* Avoid overwriting interesting failure with NO_RECIPE

* Some changes for FuelBackend

* Set space project icon

* Remove localization from TT

* Remove CNC recipe adder

* Move recipe extractor from AE2FC

* Minor internal change for ProcessingLogic#applyRecipe

* More javadoc on #getAvailableRecipeMaps

* Better implementation of #ofSupplier

* Move replicator exponent config to GT_Proxy

* Remove RC & IC2 macerator handling

* Rename StreamUtil -> GT_StreamUtil

* Refactor code around RecipeMetadataStorage

* Revise #compileRecipe javadoc

* Switch extreme diesel recipe loader to downstream recipe map

* Optimize #reMap

* Rename reload -> reloadNEICache

* Minor tweak for drawEnergyInfo

* a bit more doc

* Adjust recipe catalysts

* Add toString implementation for GT_Fluid for debug

* Minor revision for OilCrackerBackend

* Index replicator recipes by material

---------

Co-authored-by: Glease <4586901+Glease@users.noreply.github.com>
  • Loading branch information
miozune and Glease authored Dec 3, 2023
1 parent b08cde7 commit f74c7cc
Show file tree
Hide file tree
Showing 308 changed files with 12,637 additions and 12,924 deletions.
5 changes: 4 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
api("com.github.GTNewHorizons:ModularUI:1.1.24:dev")
api("com.github.GTNewHorizons:waila:1.6.5:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-288-GTNH:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.1.67-gtnh:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.1.68-gtnh-pre:dev")

implementation("com.github.GTNewHorizons:Avaritia:1.46:dev")

Expand All @@ -68,6 +68,9 @@ dependencies {
compileOnly("com.google.auto.value:auto-value-annotations:1.10.1") { transitive = false }
annotationProcessor("com.google.auto.value:auto-value:1.10.1")

// For testing iApiary
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForestryMC:4.6.14:dev")

testImplementation(platform('org.junit:junit-bom:5.9.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation("org.mockito:mockito-core:3.+")
Expand Down
16 changes: 8 additions & 8 deletions docs/RecipeBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ being the preferred choice.
## complicated recipe adder

1. If one invocation of recipe adder would add multiple recipe to same recipe map, give that recipe map a recipeEmitter
2. If one invocation of recipe adder would conditionally add recipe, define a new IGT_RecipeMap in GT_RecipeConstants
2. If one invocation of recipe adder would conditionally add recipe, define a new IRecipeMap in GT_RecipeConstants
3. If one invocation of recipe adder would add recipe to multiple recipe map,
1. If all recipe maps involved receive recipe only via this type of adding, use the chaining mechanism offered by GT_RecipeMap, i.e. addDownstream().

e.g.sMultiblockElectrolyzerRecipes and sElectrolyzerRecipes
2. Otherwise, define a new IGT_RecipeMap in GT_RecipeConstants.
4. If the target isn't a real recipe map (e.g. AssLine stuff), define a new IGT_RecipeMap in GT_RecipeConstants.
2. Otherwise, define a new IRecipeMap in GT_RecipeConstants.
4. If the target isn't a real recipe map (e.g. AssLine stuff), define a new IRecipeMap in GT_RecipeConstants.

## Downstream in an addon

Expand All @@ -44,17 +44,17 @@ This assumes you need to generate recipe into your own recipe map from a parent
## deep copy or not

There is no need to do deep copy EXCEPT you are downstream.
If you do modify the values in a downstream recipe map, call IGT_RecipeMap.deepCopyInput() before adding yourself as a downstream.
If you do modify the values in a downstream recipe map, call IRecipeMap.deepCopyInput() before adding yourself as a downstream.

## setRecipeSpecialHandler or setRecipeEmitterSingle
## recipeTransformer or recipeEmitterSingle

Prefer setRecipeSpecialHandler, unless it would throw exception on builder.build().
Prefer recipeTransformer, unless it would throw exception on builder.build().

## Special Value and Special Item

These are considered legacy. IGT_RecipeMap should avoid using these and use the more readable metadata system.
These are considered legacy. IRecipeMap should avoid using these and use the more readable metadata system.

## Use recipe builder or add() directly inside IGT_RecipeMap.doAdd()?
## Use recipe builder or add() directly inside IRecipeMap.doAdd()?

You SHOULD use the recipe builder and delegate further processing to the doAdd() on that recipe map. e.g. UniversalDistillation
However, there are situations that you need to bypass those logic. Then add() is a valid choice.
Expand Down
2 changes: 1 addition & 1 deletion docs/ResourcePacks_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You might want to change color of text displayed on GUI. You can place mcmeta fi
- `gregtech/textures/gui/background/steel.png.mcmeta` (steam steel machines)
- `gregtech/textures/gui/background/primitive.png.mcmeta` (steam primitive machines)
- `gregtech/textures/gui/background/fusion_computer.png.mcmeta` (fusion reactor controller)
- `modularui/textures/gui/background/vanilla_background.png.mcmeta` (NEI)
- `gregtech/textures/gui/background/nei_single_recipe.png.mcmeta` (NEI recipe border)

(and there might be more in the future, but currently these are exhaustive.)
You also need to place png file corresponding to mcmeta file, even if it's unchanged from the mod's default one.
Expand Down
44 changes: 15 additions & 29 deletions src/main/java/gregtech/GT_Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.logging.log4j.Logger;

import com.google.common.base.Stopwatch;
import com.google.common.collect.SetMultimap;

import appeng.api.AEApi;
import cpw.mods.fml.common.FMLCommonHandler;
Expand Down Expand Up @@ -63,6 +64,7 @@
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.ItemData;
import gregtech.api.objects.XSTR;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.threads.GT_Runnable_MachineBlockUpdate;
import gregtech.api.util.GT_Assemblyline_Server;
import gregtech.api.util.GT_Forestry_Compat;
Expand Down Expand Up @@ -100,7 +102,6 @@
import gregtech.loaders.postload.GT_BookAndLootLoader;
import gregtech.loaders.postload.GT_CraftingRecipeLoader;
import gregtech.loaders.postload.GT_CropLoader;
import gregtech.loaders.postload.GT_ExtremeDieselFuelLoader;
import gregtech.loaders.postload.GT_FakeRecipeLoader;
import gregtech.loaders.postload.GT_ItemMaxStacksizeLoader;
import gregtech.loaders.postload.GT_MachineRecipeLoader;
Expand All @@ -118,7 +119,6 @@
import gregtech.loaders.preload.GT_Loader_OreDictionary;
import gregtech.loaders.preload.GT_Loader_OreProcessing;
import gregtech.loaders.preload.GT_PreLoad;
import gregtech.nei.IMCForNEI;
import ic2.api.recipe.IRecipeInput;
import ic2.api.recipe.RecipeOutput;

Expand Down Expand Up @@ -362,7 +362,6 @@ public boolean test(ItemStack stack) {
if (Mods.HoloInventory.isModLoaded()) {
HoloInventory.init();
}
IMCForNEI.IMCSender();
GregTech_API.sLoadFinished = true;
GT_Log.out.println("GT_Mod: Load-Phase finished!");
GT_Log.ore.println("GT_Mod: Load-Phase finished!");
Expand Down Expand Up @@ -522,7 +521,6 @@ public void onPostLoad(FMLPostInitializationEvent aEvent) {
.forEach(GT_ModHandler::removeRecipeByOutputDelayed);

GT_PostLoad.nerfVanillaTools();
new GT_ExtremeDieselFuelLoader().run();

/*
* Until this point most crafting recipe additions, and removals, have been buffered. Go through, execute the
Expand Down Expand Up @@ -579,6 +577,7 @@ public void onPostLoad(FMLPostInitializationEvent aEvent) {

@Mod.EventHandler
public void onLoadComplete(FMLLoadCompleteEvent aEvent) {
gregtechproxy.onLoadComplete();
for (Runnable tRunnable : GregTech_API.sGTCompleteLoad) {
try {
tRunnable.run();
Expand Down Expand Up @@ -612,33 +611,17 @@ public void onServerStarting(FMLServerStartingEvent aEvent) {

gregtechproxy.onServerStarting();
// Check for more IC2 recipes on ServerStart to also catch MineTweaker additions
GT_ModHandler.addIC2RecipesToGT(
GT_ModHandler.getMaceratorRecipeList(),
GT_Recipe.GT_Recipe_Map.sMaceratorRecipes,
true,
true,
true);
GT_ModHandler.addIC2RecipesToGT(
GT_ModHandler.getCompressorRecipeList(),
GT_Recipe.GT_Recipe_Map.sCompressorRecipes,
true,
true,
true);
GT_ModHandler.addIC2RecipesToGT(
GT_ModHandler.getExtractorRecipeList(),
GT_Recipe.GT_Recipe_Map.sExtractorRecipes,
true,
true,
true);
GT_ModHandler.addIC2RecipesToGT(
GT_ModHandler.getOreWashingRecipeList(),
GT_Recipe.GT_Recipe_Map.sOreWasherRecipes,
false,
true,
true);
GT_ModHandler
.addIC2RecipesToGT(GT_ModHandler.getMaceratorRecipeList(), RecipeMaps.maceratorRecipes, true, true, true);
GT_ModHandler
.addIC2RecipesToGT(GT_ModHandler.getCompressorRecipeList(), RecipeMaps.compressorRecipes, true, true, true);
GT_ModHandler
.addIC2RecipesToGT(GT_ModHandler.getExtractorRecipeList(), RecipeMaps.extractorRecipes, true, true, true);
GT_ModHandler
.addIC2RecipesToGT(GT_ModHandler.getOreWashingRecipeList(), RecipeMaps.oreWasherRecipes, false, true, true);
GT_ModHandler.addIC2RecipesToGT(
GT_ModHandler.getThermalCentrifugeRecipeList(),
GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes,
RecipeMaps.thermalCentrifugeRecipes,
true,
true,
true);
Expand Down Expand Up @@ -814,6 +797,9 @@ public void onIDChangingEvent(FMLModIdMappingEvent aEvent) {
for (Map<? extends GT_ItemStack, ?> gt_itemStackMap : GregTech_API.sItemStackMappings) {
GT_Utility.reMap(gt_itemStackMap);
}
for (SetMultimap<? extends GT_ItemStack, ?> gt_itemStackMap : GregTech_API.itemStackMultiMaps) {
GT_Utility.reMap(gt_itemStackMap);
}
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
Expand Down
43 changes: 32 additions & 11 deletions src/main/java/gregtech/api/GregTech_API.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
Expand Down Expand Up @@ -107,6 +108,7 @@ public class GregTech_API {
* Fixes the HashMap Mappings for ItemStacks once the Server started
*/
public static final Collection<Map<? extends GT_ItemStack, ?>> sItemStackMappings = new ArrayList<>();
public static final Collection<SetMultimap<? extends GT_ItemStack, ?>> itemStackMultiMaps = new ArrayList<>();

/**
* The MetaTileEntity-ID-List-Length
Expand All @@ -121,17 +123,36 @@ public class GregTech_API {
/**
* A List of all registered MetaTileEntities
* <p/>
* 0 - 749 are used by GregTech. 750 - 999 are reserved for Alkalus. 1000 - 2047 are used by GregTech. 2048 - 2559
* are reserved for OvermindDL. 2560 - 3071 are reserved for Immibis. 3072 - 3583 are reserved for LinusPhoenix.
* 3584 - 4095 are reserved for BloodyAsp. 4096 - 5095 are used for GregTech Frames. 5096 - 6099 are used for
* GregTech Pipes. 6100 - 8191 are used for GregTech Decoration Blocks. 8192 - 8703 are reserved for ZL123. 8704 -
* 9215 are reserved for Mr10Movie. 9216 - 9727 are used for GregTech Automation Machines. 9728 - 10239 are reserved
* for 28Smiles. 10240 - 10751 are reserved for VirMan. 10752 - 11263 are reserved for Briareos81. 11264 - 12000 are
* reserved for Quantum64. 12001 - 12500 are reserved for RedMage17. 12501 - 13000 are reserved for bartimaeusnek.
* 13001 - 13100 are reserved for Techlone 13101 - 13500 are reserved for kekzdealer 13501 - 14000 are reserved for
* glee8e. 14001 - 14100 are reserved for glowredman 14101 - 14200 are reserved for MuXiu1997. 14201 - 14300 are
* reserved for kuba6000. 14301 - 14999 are currently free. 15000 - 16999 are reserved for TecTech. 17000 - 29999
* are currently free. 30000 - 31999 are reserved for Alkalus. 32001 - 32766 are reserved for Glod.
* 0 - 749 are used by GregTech.
* 750 - 999 are reserved for Alkalus.
* 1000 - 2047 are used by GregTech.
* 2048 - 2559 are reserved for OvermindDL.
* 2560 - 3071 are reserved for Immibis.
* 3072 - 3583 are reserved for LinusPhoenix.
* 3584 - 4095 are reserved for BloodyAsp.
* 4096 - 5095 are used for GregTech Frames.
* 5096 - 6099 are used for GregTech Pipes.
* 6100 - 8191 are used for GregTech Decoration Blocks.
* 8192 - 8703 are reserved for ZL123.
* 8704 - 9215 are reserved for Mr10Movie.
* 9216 - 9727 are used for GregTech Automation Machines.
* 9728 - 10239 are reserved for 28Smiles.
* 10240 - 10751 are reserved for VirMan.
* 10752 - 11263 are reserved for Briareos81.
* 11264 - 12000 are reserved for Quantum64.
* 12001 - 12500 are reserved for RedMage17.
* 12501 - 13000 are reserved for bartimaeusnek.
* 13001 - 13100 are reserved for Techlone.
* 13101 - 13500 are reserved for kekzdealer.
* 13501 - 14000 are reserved for glee8e.
* 14001 - 14100 are reserved for glowredman.
* 14101 - 14200 are reserved for MuXiu1997.
* 14201 - 14300 are reserved for kuba6000.
* 14301 - 14999 are currently free.
* 15000 - 16999 are reserved for TecTech.
* 17000 - 29999 are currently free.
* 30000 - 31999 are reserved for Alkalus.
* 32001 - 32766 are reserved for Glod.
* <p/>
* Contact me if you need a free ID-Range, which doesn't conflict with other Addons. You could make an ID-Config,
* but we all know what "stupid" customers think about conflicting ID's
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/gregtech/api/enums/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;

/**
* This is some kind of Periodic Table, which I use to determine Properties of the Materials.
*/
Expand Down Expand Up @@ -308,6 +310,7 @@ public enum Element {
Companion.VALUES.put(name(), this);
}

@Nonnull
public static Element get(String aMaterialName) {
return Companion.VALUES.getOrDefault(aMaterialName, _NULL);
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/gregtech/api/enums/ItemList.java
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ public enum ItemList implements IItemContainer {
Machine_Bronze_Hammer,
Machine_Bronze_Compressor,
Machine_Bronze_AlloySmelter,
Machine_Bronze_BlastFurnace,
Machine_Bricked_BlastFurnace,
Machine_Steel_Boiler_Lava,
Machine_Steel_Boiler,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/api/enums/MachineType.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum MachineType {
ASSEMBLER(FunnyTexts.ASSEMBLER, "gt.recipe.assembler"),
AUTOCLAVE(FunnyTexts.AUTOCLAVE, "gt.recipe.autoclave"),
BENDING_MACHINE(FunnyTexts.BENDING_MACHINE, "gt.recipe.metalbender"),
BREWERY(FunnyTexts.BREWERY, "gt.recipe.brewery"),
BREWERY(FunnyTexts.BREWERY, "gt.recipe.brewer"),
CANNER(FunnyTexts.CANNER, "gt.recipe.canner"),
CENTRIFUGE(FunnyTexts.CENTRIFUGE, "gt.recipe.centrifuge"),
CHEMICAL_BATH(FunnyTexts.CHEMICAL_BATH, "gt.recipe.chemicalbath"),
Expand Down Expand Up @@ -62,7 +62,7 @@ private static class FunnyTexts {
static final String ASSEMBLER = "gt.recipe.assembler.description";
static final String AUTOCLAVE = "gt.recipe.autoclave.description";
static final String BENDING_MACHINE = "gt.recipe.metalbender.description";
static final String BREWERY = "gt.recipe.brewery.description";
static final String BREWERY = "gt.recipe.brewer.description";
static final String CANNER = "gt.recipe.canner.description";
static final String CENTRIFUGE = "gt.recipe.centrifuge.description";
static final String CHEMICAL_BATH = "gt.recipe.chemicalbath.description";
Expand Down
1 change: 0 additions & 1 deletion src/main/java/gregtech/api/enums/MetaTileEntityIDs.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public enum MetaTileEntityIDs {
SIMPLE_SOLAR_BOILER(105),
STEAM_MACERATOR(106),
HP_STEAM_MACERATOR(107),
BRONZE_BLAST_FURNACE_CONTROLLER(108),
STEAM_EXTRACTOR(109),
HP_STEAM_EXTRACTOR(110),
AUTO_MAINTENANCE_HATCH(111),
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/gregtech/api/gui/modularui/GT_UITextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.stream.IntStream;

import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture;
import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture;
import com.gtnewhorizons.modularui.api.drawable.UITexture;

public class GT_UITextures {
Expand All @@ -23,6 +24,8 @@ public class GT_UITextures {
.of(GregTech.ID, "gui/background/text_field", 142, 28, 1);
public static final AdaptableUITexture BACKGROUND_TEXT_FIELD_LIGHT_GRAY = AdaptableUITexture
.of(GregTech.ID, "gui/background/text_field_light_gray", 61, 12, 1);
public static final AdaptableUITexture BACKGROUND_NEI_SINGLE_RECIPE = AdaptableUITexture
.of(GregTech.ID, "gui/background/nei_single_recipe.png", 64, 64, 2);

public static final SteamTexture SLOT_ITEM_STEAM = SteamTexture.fullImage(GregTech.ID, "gui/slot/item_%s");
public static final SteamTexture SLOT_FLUID_STEAM = SteamTexture.fullImage(GregTech.ID, "gui/slot/fluid_%s");
Expand Down Expand Up @@ -200,6 +203,10 @@ public class GT_UITextures {
public static final UITexture PROGRESSBAR_STORED_EU = UITexture.fullImage(GregTech.ID, "gui/progressbar/stored_eu");
public static final UITexture PROGRESSBAR_WIREMILL = UITexture.fullImage(GregTech.ID, "gui/progressbar/wiremill");

public static FallbackableUITexture fallbackableProgressbar(String name, UITexture fallback) {
return new FallbackableUITexture(UITexture.fullImage(GregTech.ID, "gui/progressbar/" + name), fallback);
}

public static final UITexture TAB_COVER_NORMAL = UITexture.fullImage(GregTech.ID, "gui/tab/cover_normal");
public static final UITexture TAB_COVER_HIGHLIGHT = UITexture.fullImage(GregTech.ID, "gui/tab/cover_highlight");
public static final UITexture TAB_COVER_DISABLED = UITexture.fullImage(GregTech.ID, "gui/tab/cover_disabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Represents the target of a recipe adding action, usually, but not necessarily, is a recipe map itself.
*/
public interface IGT_RecipeMap {
public interface IRecipeMap {

/**
* Add a downstream recipe map that will get to handle the original builder.
Expand All @@ -27,7 +27,7 @@ public interface IGT_RecipeMap {
*
* @param downstream the downstream recipe map to add
*/
void addDownstream(IGT_RecipeMap downstream);
void addDownstream(IRecipeMap downstream);

/**
* Actually add the recipe represented by the builder. CAN modify the builder's internal states!!!
Expand All @@ -41,17 +41,17 @@ public interface IGT_RecipeMap {
* <p>
* The returned recipe map will not have any downstreams, but can accept new downstreams.
*/
default IGT_RecipeMap deepCopyInput() {
default IRecipeMap deepCopyInput() {
return newRecipeMap(b -> doAdd(b.copy()));
}

static IGT_RecipeMap newRecipeMap(Function<? super GT_RecipeBuilder, Collection<GT_Recipe>> func) {
return new IGT_RecipeMap() {
static IRecipeMap newRecipeMap(Function<? super GT_RecipeBuilder, Collection<GT_Recipe>> func) {
return new IRecipeMap() {

private final Collection<IGT_RecipeMap> downstreams = new ArrayList<>();
private final Collection<IRecipeMap> downstreams = new ArrayList<>();

@Override
public void addDownstream(IGT_RecipeMap downstream) {
public void addDownstream(IRecipeMap downstream) {
downstreams.add(downstream);
}

Expand All @@ -63,7 +63,7 @@ public Collection<GT_Recipe> doAdd(GT_RecipeBuilder builder) {
ret.add(out);
builder.clearInvalid();
if (!out.isEmpty()) {
for (IGT_RecipeMap downstream : downstreams) {
for (IRecipeMap downstream : downstreams) {
ret.add(downstream.doAdd(builder));
}
}
Expand Down
Loading

0 comments on commit f74c7cc

Please sign in to comment.