diff options
| author | Glease <4586901+Glease@users.noreply.github.com> | 2023-04-02 00:02:47 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-01 18:02:47 +0200 |
| commit | 6b77557e0e87cf5afd9ebd3985323ff1249e615c (patch) | |
| tree | 36474042ef39f863aedc007eab81a9b09cc7aa78 /src/main/java/gregtech/api/util | |
| parent | 655cc902d3df19a1ac2bfaa38cc928ed629d0171 (diff) | |
| download | GT5-Unofficial-6b77557e0e87cf5afd9ebd3985323ff1249e615c.tar.gz GT5-Unofficial-6b77557e0e87cf5afd9ebd3985323ff1249e615c.tar.bz2 GT5-Unofficial-6b77557e0e87cf5afd9ebd3985323ff1249e615c.zip | |
Recipe Adder v2 (#1770)
* add everything
* fixes
* migrate plasma forge recipes
* syntax update
* make chances array length differ a fatal error
* time constants + long eut overload
* migrate extruder recipes
* migrate electromagnetic separator recipes
* migrate wiremill recipes
* migrate forming press recipes
* migrate bender recipes
* add doc to clarify the three itemInputs
* migrate alloy smelter recipes
* migrate arc furnace recipes
* added ModIDs enum
* sort ModIDs
* migrate autoclave recipes
* migrated some assembler recipes
* split a bit more assembler recipes
* migrate canner recipes
* migrate brewing recipes
* ic2 mod check in canner recipes
* use some loops to reduce the amount of recipes to migrate
* add requested helper methods
* migrate vacuum freezer recipes
* migrate thermal centrifuge recipes
* format smelter recipes only, doesn't go through normal GT recipe
* migrated slicer recipes
* migrated sifter recipes
* Use proper enum now
* remove more constants
* cleaning cutting recipes before migration
* remove tons of dead commented recipes
* migrate pyrolyse recipes
* use ModIDs enum more
* migrate printer recipes
* add a less confusing way to specify value of specialItem
* migrate pulverizer recipes
* less confusing special item specification
* even more ModIDs enum usage
* fix auto * import confusing Minecraft enum value with Minecraft client object
* migrated blast furnace recipes
* migrated Centrifuge recipes
* migrated assembler recipes
* migrated implosion compressor recipes
* migrated extractor recipes
* migrated mixer recipes
* remove useless code
* mgrate universal chemical recipes
* refactor chemical recipes
* migrate single block only chem reactor recipes
* migrate chem reactor recipes
* reworked circuit assembler recipes before migrating them
* migrated circuit assembler recipes
* fix merge conflict for assembler recipes
* remove leftover of the merge conflicts
* fix weird translation glitch
* example of assembly line recipe using RA2
* bugfixes for assline
* remove specialValue usage in blast furnace recipes
* fix more bugs
* add nooptimize to where it make sense
* add recipe descriptions
* Materials.Superconductor -> Materials.SuperconductorUHV
* remove useless Object creations
* remove explicit long casts
* migrate assemblyline recipes
* migrate chemical bath recipes
* migrate compressor recipes
* move smelting recipe where it belongs
* migrated cutting machine recipes
* migrated fermenter recipes (unhide alcohol)
* remove explicit long casts
* migrate fluid canner recipes
* migrate fluid heater recipes
* migrated fusion recipes
* migrated lathe recipes
* migrated laser engraver recipes
* migrated packager recipes
* migrated forge hammer recipes
* migrated TPM recipes
* exit early and reduced indents
* migrated fluid extractor recipes
* migrated fluid solidifier recipes
* migrated electrolyzer recipes
* migrated crop processing recipes
* migrated default polymerization recipes
* migrate distillery recipes
* migrate matter amplifier recipes
* add metadata identifier for fusion ignition threshold
* migrate fuel recipes
* update bs
(cherry picked from commit c2d931c9b6caa0376e9d50591894cd849021104d)
* spotless
(cherry picked from commit 1060f5357fb95e28bfae1f052025f55dabc21a0f)
* guard against null itemstacks
* wrong translation
* fix empty arrays being accessed
* add 0 duration and 0 EU/t for fuel recipes
* fix typo in matter amplifier recipes
* spotless apply
---------
Co-authored-by: boubou19 <miisterunknown@gmail.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/api/util')
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_BaseCrop.java | 4 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_ModReference.java | 29 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_Recipe.java | 601 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_RecipeBuilder.java | 713 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_RecipeConstants.java | 258 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_RecipeMapUtil.java | 196 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/util/GT_Utility.java | 83 |
7 files changed, 1843 insertions, 41 deletions
diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java index 65d2900176..bfffbe8572 100644 --- a/src/main/java/gregtech/api/util/GT_BaseCrop.java +++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java @@ -1,6 +1,7 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.ModIDs.IC2CropPlugin; import java.util.ArrayList; import java.util.List; @@ -12,7 +13,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import speiger.src.crops.api.ICropCardInfo; -import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -33,7 +33,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { mGrowthSpeed = 0; private ItemStack mDrop = null, mSpecialDrops[] = null; private Materials mBlock = null; - private static boolean bIc2NeiLoaded = Loader.isModLoaded("Ic2Nei"); + private static boolean bIc2NeiLoaded = IC2CropPlugin.isModLoaded(); /** * To create new Crops diff --git a/src/main/java/gregtech/api/util/GT_ModReference.java b/src/main/java/gregtech/api/util/GT_ModReference.java new file mode 100644 index 0000000000..02a1116f68 --- /dev/null +++ b/src/main/java/gregtech/api/util/GT_ModReference.java @@ -0,0 +1,29 @@ +package gregtech.api.util; + +import static gregtech.api.enums.ModIDs.GTPlusPlus; +import static gregtech.api.enums.ModIDs.Railcraft; + +import cpw.mods.fml.common.Loader; + +@Deprecated // use gregtech.api.enums.ModIDs instead +public enum GT_ModReference { + + RAILCRAFT(Railcraft.modID), + GTPP(GTPlusPlus.modID),; + + private final boolean loaded; + private final String modID; + + GT_ModReference(String modID) { + loaded = Loader.isModLoaded(modID); + this.modID = modID; + } + + public boolean isLoaded() { + return loaded; + } + + public String getModID() { + return modID; + } +} diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 3b7f64aae8..e7443a63b5 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1,7 +1,14 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.ModIDs.GTPlusPlus; +import static gregtech.api.enums.ModIDs.NEICustomDiagrams; +import static gregtech.api.enums.ModIDs.Railcraft; +import static gregtech.api.util.GT_RecipeConstants.ADDITIVE_AMOUNT; +import static gregtech.api.util.GT_RecipeMapUtil.*; import static gregtech.api.util.GT_Utility.formatNumbers; +import static gregtech.api.util.GT_Utility.isArrayEmptyOrNull; +import static gregtech.api.util.GT_Utility.isArrayOfLength; import static net.minecraft.util.EnumChatFormatting.GRAY; import static net.minecraft.util.StatCollector.translateToLocal; @@ -9,10 +16,15 @@ import java.awt.*; import java.util.*; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import java.util.function.Function; import java.util.function.Supplier; import javax.annotation.Nullable; +import mods.railcraft.common.blocks.aesthetics.cube.EnumCube; +import mods.railcraft.common.items.RailcraftToolItems; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.init.Blocks; @@ -27,6 +39,8 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -34,6 +48,7 @@ import appeng.util.ReadableNumberConverter; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; +import com.google.common.collect.Iterables; import com.gtnewhorizons.modularui.api.GlStateManager; import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; @@ -60,6 +75,7 @@ import gregtech.api.gui.GT_GUIColorOverride; import gregtech.api.gui.modularui.FallbackableSteamTexture; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.gui.modularui.SteamTexture; +import gregtech.api.interfaces.IGT_RecipeMap; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.objects.GT_FluidStack; @@ -155,13 +171,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ public List<List<StackTraceElement>> stackTraces = new ArrayList<>(); - private GT_Recipe(GT_Recipe aRecipe) { - mInputs = GT_Utility.copyStackArray((Object[]) aRecipe.mInputs); - mOutputs = GT_Utility.copyStackArray((Object[]) aRecipe.mOutputs); + private GT_Recipe(GT_Recipe aRecipe, boolean shallow) { + mInputs = shallow ? aRecipe.mInputs : GT_Utility.copyStackArray((Object[]) aRecipe.mInputs); + mOutputs = shallow ? aRecipe.mOutputs : GT_Utility.copyStackArray((Object[]) aRecipe.mOutputs); mSpecialItems = aRecipe.mSpecialItems; mChances = aRecipe.mChances; - mFluidInputs = GT_Utility.copyFluidArray(aRecipe.mFluidInputs); - mFluidOutputs = GT_Utility.copyFluidArray(aRecipe.mFluidOutputs); + mFluidInputs = shallow ? aRecipe.mFluidInputs : GT_Utility.copyFluidArray(aRecipe.mFluidInputs); + mFluidOutputs = shallow ? aRecipe.mFluidOutputs : GT_Utility.copyFluidArray(aRecipe.mFluidOutputs); mDuration = aRecipe.mDuration; mSpecialValue = aRecipe.mSpecialValue; mEUt = aRecipe.mEUt; @@ -174,6 +190,29 @@ public class GT_Recipe implements Comparable<GT_Recipe> { reloadOwner(); } + // only used for GT_RecipeBuilder. Should not be called otherwise + GT_Recipe(ItemStack[] mInputs, ItemStack[] mOutputs, FluidStack[] mFluidInputs, FluidStack[] mFluidOutputs, + int[] mChances, Object mSpecialItems, int mDuration, int mEUt, int mSpecialValue, boolean mEnabled, + boolean mHidden, boolean mFakeRecipe, boolean mCanBeBuffered, boolean mNeedsEmptyOutput, String[] neiDesc) { + this.mInputs = mInputs; + this.mOutputs = mOutputs; + this.mFluidInputs = mFluidInputs; + this.mFluidOutputs = mFluidOutputs; + this.mChances = mChances; + this.mSpecialItems = mSpecialItems; + this.mDuration = mDuration; + this.mEUt = mEUt; + this.mSpecialValue = mSpecialValue; + this.mEnabled = mEnabled; + this.mHidden = mHidden; + this.mFakeRecipe = mFakeRecipe; + this.mCanBeBuffered = mCanBeBuffered; + this.mNeedsEmptyOutput = mNeedsEmptyOutput; + this.neiDesc = neiDesc; + + reloadOwner(); + } + public GT_Recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { if (aInputs == null) aInputs = new ItemStack[0]; @@ -556,7 +595,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } public GT_Recipe copy() { - return new GT_Recipe(this); + return new GT_Recipe(this, false); + } + + public GT_Recipe copyShallow() { + return new GT_Recipe(this, true); } public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, FluidStack[] aFluidInputs, @@ -768,6 +811,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { final List<String> excludedClasses = Arrays.asList( "java.lang.Thread", "gregtech.api.util.GT_Recipe", + "gregtech.api.util.GT_RecipeBuilder", "gregtech.api.util.GT_Recipe$GT_Recipe_Map", "gregtech.common.GT_RecipeAdder"); if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace) { @@ -800,6 +844,37 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } + public GT_Recipe setInputs(ItemStack... aInputs) { + // TODO determine if we need this without trailing nulls call + this.mInputs = ArrayExt.withoutTrailingNulls(aInputs, ItemStack[]::new); + return this; + } + + public GT_Recipe setOutputs(ItemStack... aOutputs) { + this.mOutputs = ArrayExt.withoutTrailingNulls(aOutputs, ItemStack[]::new); + return this; + } + + public GT_Recipe setFluidInputs(FluidStack... aInputs) { + this.mFluidInputs = ArrayExt.withoutTrailingNulls(aInputs, FluidStack[]::new); + return this; + } + + public GT_Recipe setFluidOutputs(FluidStack... aOutputs) { + this.mFluidOutputs = ArrayExt.withoutTrailingNulls(aOutputs, FluidStack[]::new); + return this; + } + + public GT_Recipe setDuration(int aDuration) { + this.mDuration = aDuration; + return this; + } + + public GT_Recipe setEUt(int aEUt) { + this.mEUt = aEUt; + return this; + } + public static class GT_Recipe_AssemblyLine { public static final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<GT_Recipe_AssemblyLine>(); @@ -992,7 +1067,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @SuppressWarnings("StaticInitializerReferencesSubClass") - public static class GT_Recipe_Map { + public static class GT_Recipe_Map implements IGT_RecipeMap { /** * Contains all Recipe Maps @@ -1020,6 +1095,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("orewasher", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sThermalCentrifugeRecipes = new GT_Recipe_Map( new HashSet<>(1000), @@ -1038,6 +1114,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("thermalcentrifuge", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sCompressorRecipes = new GT_Recipe_Map( new HashSet<>(750), @@ -1055,6 +1132,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR) + .setRecipeConfigFile("compressor", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT) .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR_STEAM) .setProgressBarSteam(GT_UITextures.PROGRESSBAR_COMPRESS_STEAM); @@ -1074,6 +1152,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) + .setRecipeConfigFile("extractor", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT) .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_STEAM) .setProgressBarSteam(GT_UITextures.PROGRESSBAR_EXTRACT_STEAM); @@ -1257,7 +1336,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .setUsualFluidInputCount(4); + .setUsualFluidInputCount(4).setDisableOptimize(true); public static final GT_Recipe_Map sPlasmaArcFurnaceRecipes = new GT_Recipe_Map( new HashSet<>(20000), "gt.recipe.plasmaarcfurnace", @@ -1273,7 +1352,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("arcfurnace", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sArcFurnaceRecipes = new GT_Recipe_Map( new HashSet<>(20000), "gt.recipe.arcfurnace", @@ -1289,7 +1369,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("arcfurnace", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sPrinterRecipes = new GT_Recipe_Map_Printer( new HashSet<>(5), "gt.recipe.printer", @@ -1308,6 +1389,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_PAGE_BLANK) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PAGE_PRINTED) .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_STICK) + .setRecipeConfigFile("printer", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sSifterRecipes = new GT_Recipe_Map( new HashSet<>(105), @@ -1324,7 +1406,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN); + true).setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN) + .setRecipeConfigFile("sifter", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sPressRecipes = new GT_Recipe_Map_FormingPress( new HashSet<>(300), "gt.recipe.press", @@ -1343,6 +1426,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_PRESS_1) .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_PRESS_2) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PRESS_3) + .setRecipeConfigFile("press", FIRST_ITEM_OUTPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sLaserEngraverRecipes = new GT_Recipe_Map( new HashSet<>(810), @@ -1361,7 +1445,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_LENS) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(2).setUsualFluidOutputCount(2); + .setRecipeConfigFile("laserengraving", FIRST_ITEM_OUTPUT).setUsualFluidInputCount(2) + .setUsualFluidOutputCount(2); public static final GT_Recipe_Map sMixerRecipes = new GT_Recipe_Map( new HashSet<>(900), "gt.recipe.mixer", @@ -1379,6 +1464,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("mixer", FIRST_ITEM_OR_FLUID_OUTPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_MIXER, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map( new HashSet<>(300), @@ -1398,6 +1484,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_GEM) .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("autoclave", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sElectroMagneticSeparatorRecipes = new GT_Recipe_Map( new HashSet<>(50), @@ -1416,6 +1503,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("electromagneticseparator", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sPolarizerRecipes = new GT_Recipe_Map( new HashSet<>(300), @@ -1432,7 +1520,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); + true).setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("polarizer", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sMaceratorRecipes = new GT_Recipe_Map_Macerator( new HashSet<>(16600), "gt.recipe.macerator", @@ -1451,6 +1540,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("pulveriser", FIRST_ITEM_INPUT) .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE_STEAM) .setSlotOverlaySteam(true, GT_UITextures.OVERLAY_SLOT_DUST_STEAM) .setProgressBarSteam(GT_UITextures.PROGRESSBAR_MACERATE_STEAM); @@ -1469,7 +1559,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); + true).setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW) + .setRecipeConfigFile("chemicalbath", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sFluidCannerRecipes = new GT_Recipe_Map_FluidCanner( new HashSet<>(2100), "gt.recipe.fluidcanner", @@ -1487,6 +1578,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setRecipeConfigFile("canning", FIRST_ITEM_INPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBrewingRecipes = new GT_Recipe_Map( new HashSet<>(450), @@ -1504,6 +1596,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CAULDRON) + .setRecipeConfigFile("brewing", FIRST_FLUIDSTACK_OUTPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFluidHeaterRecipes = new GT_Recipe_Map( new HashSet<>(10), @@ -1522,6 +1615,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_HEATER_1) .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_HEATER_2) + .setRecipeConfigFile("fluidheater", FIRST_FLUIDSTACK_OUTPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sDistilleryRecipes = new GT_Recipe_Map( new HashSet<>(400), @@ -1540,7 +1634,48 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_BEAKER_1) .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_BEAKER_2) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("distillery", FIRST_FLUIDSTACK_OUTPUT).setRecipeSpecialHandler(r -> { + int aInput = r.mFluidInputs[0].amount, aOutput = r.mFluidOutputs[0].amount, + aDuration = r.mDuration; + + // reduce the batch size if fluid amount is exceeding + int tScale = (Math.max(aInput, aOutput) + 999) / 1000; + if (tScale <= 0) tScale = 1; + if (tScale > 1) { + // trying to find whether there is a better factor + for (int i = tScale; i <= 5; i++) { + if (aInput % i == 0 && aDuration % i == 0) { + tScale = i; + break; + } + } + for (int i = tScale; i <= 5; i++) { + if (aInput % i == 0 && aDuration % i == 0 && aOutput % i == 0) { + tScale = i; + break; + } + } + aInput = (aInput + tScale - 1) / tScale; + aOutput = aOutput / tScale; + if (!isArrayEmptyOrNull(r.mOutputs)) { + ItemData tData = GT_OreDictUnificator.getItemData(r.mOutputs[0]); + if (tData != null && (tData.mPrefix == OrePrefixes.dust + || OrePrefixes.dust.mFamiliarPrefixes.contains(tData.mPrefix))) { + r.mOutputs[0] = GT_OreDictUnificator.getDust( + tData.mMaterial.mMaterial, + tData.mMaterial.mAmount * r.mOutputs[0].stackSize / tScale); + } else { + if (r.mOutputs[0].stackSize / tScale == 0) r.mOutputs[0] = GT_Values.NI; + else r.mOutputs[0] = GT_Utility + .copyAmount(r.mOutputs[0].stackSize / tScale, r.mOutputs[0]); + } + } + aDuration = (aDuration + tScale - 1) / tScale; + r.mFluidInputs[0] = GT_Utility.copyAmount(aInput, r.mFluidInputs[0]); + r.mFluidOutputs[0] = GT_Utility.copyAmount(aOutput, r.mFluidOutputs[0]); + r.mDuration = aDuration; + } + }).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFermentingRecipes = new GT_Recipe_Map( new HashSet<>(50), "gt.recipe.fermenter", @@ -1556,7 +1691,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("fermenting", FIRST_FLUIDSTACK_OUTPUT); public static final GT_Recipe_Map sFluidSolidficationRecipes = new GT_Recipe_Map( new HashSet<>(35000), "gt.recipe.fluidsolidifier", @@ -1573,7 +1709,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MOLD) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("fluidsolidifier", FIRST_ITEM_OUTPUT).setRecipeSpecialHandler(r -> { + if (ArrayUtils.isNotEmpty(r.mFluidInputs)) { + if (Materials.PhasedGold.getMolten(1).isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.VibrantAlloy.getMolten(r.mFluidInputs[0].amount) }; + else if (Materials.PhasedIron.getMolten(1).isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.PulsatingIron.getMolten(r.mFluidInputs[0].amount) }; + } + }).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFluidExtractionRecipes = new GT_Recipe_Map( new HashSet<>(15000), "gt.recipe.fluidextractor", @@ -1590,7 +1735,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("fluidextractor", FIRST_ITEM_INPUT).setRecipeSpecialHandler(r -> { + if (ArrayUtils.isNotEmpty(r.mFluidInputs)) { + if (Materials.PhasedGold.getMolten(1).isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.VibrantAlloy.getMolten(r.mFluidInputs[0].amount) }; + else if (Materials.PhasedIron.getMolten(1).isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.PulsatingIron.getMolten(r.mFluidInputs[0].amount) }; + } + }).setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBoxinatorRecipes = new GT_Recipe_Map( new HashSet<>(2500), "gt.recipe.packager", @@ -1607,6 +1761,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_BOX) + .setRecipeConfigFile("boxing", FIRST_ITEM_OUTPUT) .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_BOXED) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sUnboxinatorRecipes = new GT_Recipe_Map_Unboxinator( @@ -1625,6 +1780,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BOXED) + .setRecipeConfigFile("unboxing", FIRST_ITEM_OUTPUT) .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFusionRecipes = new GT_Recipe_Map_FluidOnly( new HashSet<>(50), @@ -1643,6 +1799,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) .useComparatorForNEI(true).setUsualFluidInputCount(2) + .setRecipeConfigFile("fusion", FIRST_FLUID_OUTPUT).setDisableOptimize(true) .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); public static final GT_Recipe_Map sComplexFusionRecipes = new GT_Recipe_Map_ComplexFusion( new HashSet<>(50), @@ -1662,7 +1819,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) .setUsualFluidInputCount(16).setUsualFluidOutputCount(16) .setNEITransferRect(new Rectangle(79, 34, 18, 18)).setLogoPos(80, 61) - .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); + .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE).setDisableOptimize(true); public static final GT_Recipe_Map sCentrifugeRecipes = new GT_Recipe_Map( new HashSet<>(1200), "gt.recipe.centrifuge", @@ -1679,6 +1836,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) + .setRecipeConfigFile("centrifuge", FIRST_ITEM_OR_FLUID_INPUT) .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_FLUID) .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); @@ -1698,9 +1856,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CHARGER) + .setRecipeConfigFile("electrolyzer", FIRST_ITEM_OR_FLUID_INPUT) .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CHARGER_FLUID) .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + /** + * Use special value as coil heat level. + */ public static final GT_Recipe_Map sBlastRecipes = new GT_Recipe_Map( new HashSet<>(800), "gt.recipe.blastfurnace", @@ -1717,7 +1879,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { " K", false, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("blastfurnace", FIRST_ITEM_INPUT) .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); + /** + * Use special value as coil heat level. + */ public static final GT_Recipe_Map sPlasmaForgeRecipes = new GT_Recipe_Map_LargeNEI( new HashSet<>(20), "gt.recipe.plasmaforge", @@ -1734,7 +1900,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { " K", false, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(9).setUsualFluidOutputCount(9) + .setUsualFluidInputCount(9).setUsualFluidOutputCount(9).setDisableOptimize(true) .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); public static final GT_Recipe_Map sTranscendentPlasmaMixerRecipes = new TranscendentPlasmaMixerRecipeMap( @@ -1752,7 +1918,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 0, "", false, - true); + true).setDisableOptimize(true); public static class GT_FakeSpaceProjectRecipe extends GT_Recipe { @@ -1877,7 +2043,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { .setSize(bar2Width, 72)); } }.useModularUI(true).setRenderRealStackSizes(false).setUsualFluidInputCount(4).setNEIBackgroundOffset(2, 23) - .setLogoPos(152, 83); + .setLogoPos(152, 83).setDisableOptimize(true); public static class TranscendentPlasmaMixerRecipeMap extends GT_Recipe_Map { @@ -1952,7 +2118,71 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, false, - true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setRecipeEmitter(builder -> { + Optional<GT_Recipe> rr = builder.validateInputCount(1, 2).validateOutputCount(1, 2) + .validateNoInputFluid().validateNoOutputFluid().noOptimize().build(); + if (!rr.isPresent()) return Collections.emptyList(); + ItemStack aInput1 = builder.getItemInputBasic(0); + ItemStack aInput2 = builder.getItemInputBasic(1); + ItemStack aOutput1 = builder.getItemOutput(0); + ItemStack aOutput2 = builder.getItemOutput(1); + if ((aInput1 == null && aInput2 == null) || (aOutput1 == null && aOutput2 == null)) + return Collections.emptyList(); + int aCoalAmount = builder.getMetadata(ADDITIVE_AMOUNT); + if (aCoalAmount <= 0) return Coll |
