From f74c7cc297d1d19d38a19683cd277ad9ce605d3a Mon Sep 17 00:00:00 2001 From: miozune Date: Mon, 4 Dec 2023 05:34:27 +0900 Subject: Refactor RecipeMap (#2345) * 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> --- src/main/java/gregtech/GT_Mod.java | 44 +- src/main/java/gregtech/api/GregTech_API.java | 43 +- src/main/java/gregtech/api/enums/Element.java | 3 + src/main/java/gregtech/api/enums/ItemList.java | 1 - src/main/java/gregtech/api/enums/MachineType.java | 4 +- .../java/gregtech/api/enums/MetaTileEntityIDs.java | 1 - .../gregtech/api/gui/modularui/GT_UITextures.java | 7 + .../gregtech/api/interfaces/IGT_RecipeMap.java | 74 - .../java/gregtech/api/interfaces/IRecipeMap.java | 74 + .../api/interfaces/internal/IGT_RecipeAdder.java | 26 - .../interfaces/metatileentity/IMetaTileEntity.java | 8 - .../tileentity/IOverclockDescriptionProvider.java | 15 + .../api/interfaces/tileentity/IRecipeLockable.java | 5 +- .../interfaces/tileentity/RecipeMapWorkable.java | 49 + .../gregtech/api/items/GT_MetaGenerated_Item.java | 4 +- .../api/logic/ComplexParallelProcessingLogic.java | 7 +- .../java/gregtech/api/logic/ProcessingLogic.java | 174 +- .../implementations/GT_MetaPipeEntity_Frame.java | 4 +- .../GT_MetaTileEntity_BasicGenerator.java | 22 +- .../GT_MetaTileEntity_BasicMachine.java | 325 +- .../GT_MetaTileEntity_BasicMachine_Bronze.java | 14 +- .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 278 +- .../GT_MetaTileEntity_BasicMachine_Steel.java | 8 +- ...MetaTileEntity_ExtendedPowerMultiBlockBase.java | 31 +- .../GT_MetaTileEntity_Hatch_Input.java | 10 +- .../GT_MetaTileEntity_Hatch_InputBus.java | 17 +- .../GT_MetaTileEntity_MultiBlockBase.java | 107 +- .../multiblock/base/Controller.java | 4 +- .../overclockdescriber/EUNoOverclockDescriber.java | 110 + .../overclockdescriber/EUOverclockDescriber.java | 80 + .../FusionOverclockDescriber.java | 69 + .../overclockdescriber/OverclockDescriber.java | 106 + .../SteamOverclockDescriber.java | 64 + .../gregtech/api/recipe/BasicUIProperties.java | 251 + .../api/recipe/BasicUIPropertiesBuilder.java | 264 + .../java/gregtech/api/recipe/FindRecipeQuery.java | 178 + .../gregtech/api/recipe/NEIRecipeProperties.java | 89 + .../api/recipe/NEIRecipePropertiesBuilder.java | 100 + .../java/gregtech/api/recipe/RecipeCategories.java | 56 + .../java/gregtech/api/recipe/RecipeCategory.java | 81 + .../gregtech/api/recipe/RecipeCategoryHolder.java | 13 + .../gregtech/api/recipe/RecipeCategorySetting.java | 52 + src/main/java/gregtech/api/recipe/RecipeMap.java | 395 ++ .../java/gregtech/api/recipe/RecipeMapBackend.java | 461 ++ .../api/recipe/RecipeMapBackendProperties.java | 77 + .../recipe/RecipeMapBackendPropertiesBuilder.java | 119 + .../java/gregtech/api/recipe/RecipeMapBuilder.java | 522 ++ .../gregtech/api/recipe/RecipeMapFrontend.java | 395 ++ src/main/java/gregtech/api/recipe/RecipeMaps.java | 1177 ++++ .../gregtech/api/recipe/RecipeMetadataKey.java | 84 + .../api/recipe/check/FindRecipeResult.java | 125 - .../gregtech/api/recipe/check/RecipeValidator.java | 80 - .../api/recipe/check/SingleRecipeCheck.java | 25 +- .../gregtech/api/recipe/maps/AssemblerBackend.java | 35 + .../api/recipe/maps/AssemblyLineFrontend.java | 76 + .../api/recipe/maps/DistillationTowerFrontend.java | 38 + .../api/recipe/maps/FluidCannerBackend.java | 73 + .../api/recipe/maps/FluidOnlyFrontend.java | 33 + .../api/recipe/maps/FormingPressBackend.java | 92 + .../java/gregtech/api/recipe/maps/FuelBackend.java | 75 + .../gregtech/api/recipe/maps/FurnaceBackend.java | 52 + .../api/recipe/maps/LargeBoilerFuelBackend.java | 132 + .../api/recipe/maps/LargeBoilerFuelFrontend.java | 25 + .../gregtech/api/recipe/maps/LargeNEIFrontend.java | 65 + .../gregtech/api/recipe/maps/MicrowaveBackend.java | 145 + .../gregtech/api/recipe/maps/NonGTBackend.java | 52 + .../api/recipe/maps/OilCrackerBackend.java | 41 + .../gregtech/api/recipe/maps/PrinterBackend.java | 142 + .../gregtech/api/recipe/maps/RecyclerBackend.java | 51 + .../api/recipe/maps/ReplicatorBackend.java | 100 + .../api/recipe/maps/SpaceProjectFrontend.java | 131 + .../maps/TranscendentPlasmaMixerFrontend.java | 56 + .../api/recipe/maps/UnpackagerBackend.java | 53 + .../metadata/EmptyRecipeMetadataStorage.java | 50 + .../recipe/metadata/IRecipeMetadataStorage.java | 34 + .../api/recipe/metadata/PCBFactoryTierKey.java | 30 + .../api/recipe/metadata/PCBFactoryUpgrade.java | 7 + .../api/recipe/metadata/PCBFactoryUpgradeKey.java | 32 + .../api/recipe/metadata/RecipeMetadataStorage.java | 56 + .../recipe/metadata/SimpleRecipeMetadataKey.java | 27 + .../api/util/FieldsAreNonnullByDefault.java | 18 + src/main/java/gregtech/api/util/GT_Config.java | 14 + .../java/gregtech/api/util/GT_Forestry_Compat.java | 25 +- .../java/gregtech/api/util/GT_LanguageManager.java | 1 - src/main/java/gregtech/api/util/GT_ModHandler.java | 34 +- .../gregtech/api/util/GT_OverclockCalculator.java | 34 +- .../java/gregtech/api/util/GT_ParallelHelper.java | 66 +- .../api/util/GT_ProcessingArray_Manager.java | 8 +- src/main/java/gregtech/api/util/GT_Recipe.java | 5863 +------------------- .../java/gregtech/api/util/GT_RecipeBuilder.java | 257 +- .../java/gregtech/api/util/GT_RecipeConstants.java | 125 +- .../java/gregtech/api/util/GT_RecipeMapUtil.java | 28 +- .../gregtech/api/util/GT_RecipeRegistrator.java | 113 +- src/main/java/gregtech/api/util/GT_StreamUtil.java | 44 + src/main/java/gregtech/api/util/GT_Utility.java | 27 +- .../api/util/MethodsReturnNonnullByDefault.java | 22 + .../gregtech/api/util/VoidProtectionHelper.java | 22 - .../java/gregtech/client/GT_GUI_ClientConfig.java | 10 +- src/main/java/gregtech/common/GT_Client.java | 42 +- src/main/java/gregtech/common/GT_Proxy.java | 35 +- src/main/java/gregtech/common/GT_RecipeAdder.java | 369 +- .../common/blocks/GT_Block_Stones_Abstract.java | 22 +- src/main/java/gregtech/common/fluid/GT_Fluid.java | 9 +- .../gregtech/common/gui/modularui/UIHelper.java | 82 +- .../common/items/GT_MetaGenerated_Item_01.java | 125 +- .../common/items/GT_MetaGenerated_Item_02.java | 62 +- src/main/java/gregtech/common/items/ItemComb.java | 12 +- src/main/java/gregtech/common/items/ItemDrop.java | 10 +- .../java/gregtech/common/items/ItemPropolis.java | 8 +- .../misc/spaceprojects/SpaceProjectManager.java | 18 +- .../gregtech/common/power/BasicMachineEUPower.java | 74 - src/main/java/gregtech/common/power/EUPower.java | 58 - .../java/gregtech/common/power/FusionPower.java | 52 - src/main/java/gregtech/common/power/Power.java | 73 - .../java/gregtech/common/power/SteamPower.java | 54 - .../gregtech/common/power/UnspecifiedEUPower.java | 28 - .../automation/GT_MetaTileEntity_RecipeFilter.java | 67 +- .../GT_MetaTileEntity_DieselGenerator.java | 9 +- .../generators/GT_MetaTileEntity_GasTurbine.java | 7 +- .../GT_MetaTileEntity_MagicEnergyConverter.java | 7 +- .../GT_MetaTileEntity_MagicalEnergyAbsorber.java | 7 +- .../GT_MetaTileEntity_NaquadahReactor.java | 20 +- .../GT_MetaTileEntity_PlasmaGenerator.java | 7 +- .../generators/GT_MetaTileEntity_SteamTurbine.java | 4 +- .../GT_MetaTileEntity_Hatch_InputBus_ME.java | 4 +- .../machines/IRecipeProcessingAwareHatch.java | 21 +- .../basic/GT_MetaTileEntity_Boxinator.java | 11 +- .../basic/GT_MetaTileEntity_IndustrialApiary.java | 31 +- .../basic/GT_MetaTileEntity_Massfabricator.java | 97 +- .../machines/basic/GT_MetaTileEntity_Miner.java | 26 +- .../basic/GT_MetaTileEntity_PotionBrewer.java | 9 +- .../basic/GT_MetaTileEntity_Replicator.java | 94 +- .../basic/GT_MetaTileEntity_RockBreaker.java | 9 +- .../machines/basic/GT_MetaTileEntity_Scanner.java | 20 +- .../multi/GT_MetaTileEntity_AssemblyLine.java | 7 +- .../GT_MetaTileEntity_BronzeBlastFurnace.java | 80 - .../multi/GT_MetaTileEntity_Charcoal_Pit.java | 4 +- .../multi/GT_MetaTileEntity_DieselEngine.java | 18 +- .../multi/GT_MetaTileEntity_DistillationTower.java | 7 +- .../GT_MetaTileEntity_ElectricBlastFurnace.java | 6 +- .../GT_MetaTileEntity_ExtremeDieselEngine.java | 8 +- .../multi/GT_MetaTileEntity_FusionComputer.java | 58 +- .../multi/GT_MetaTileEntity_FusionComputer1.java | 15 +- .../multi/GT_MetaTileEntity_FusionComputer2.java | 15 +- .../multi/GT_MetaTileEntity_FusionComputer3.java | 15 +- .../GT_MetaTileEntity_ImplosionCompressor.java | 7 +- .../GT_MetaTileEntity_IntegratedOreFactory.java | 13 +- .../multi/GT_MetaTileEntity_LargeBoiler.java | 15 +- .../GT_MetaTileEntity_LargeChemicalReactor.java | 7 +- .../multi/GT_MetaTileEntity_LargeTurbine_Gas.java | 16 +- ...GT_MetaTileEntity_LargeTurbine_GasAdvanced.java | 16 +- .../GT_MetaTileEntity_LargeTurbine_Plasma.java | 5 +- .../multi/GT_MetaTileEntity_MultiFurnace.java | 7 +- .../multi/GT_MetaTileEntity_NanoForge.java | 6 +- .../multi/GT_MetaTileEntity_OilCracker.java | 21 +- .../GT_MetaTileEntity_OreDrillingPlantBase.java | 3 +- .../multi/GT_MetaTileEntity_PCBFactory.java | 20 +- .../multi/GT_MetaTileEntity_PlasmaForge.java | 6 +- .../GT_MetaTileEntity_PrimitiveBlastFurnace.java | 14 +- .../multi/GT_MetaTileEntity_ProcessingArray.java | 10 +- .../multi/GT_MetaTileEntity_PyrolyseOven.java | 7 +- .../GT_MetaTileEntity_TranscendentPlasmaMixer.java | 6 +- .../multi/GT_MetaTileEntity_VacuumFreezer.java | 7 +- .../machines/multiblock/AdvChemicalReactor.java | 7 +- .../machines/multiblock/Macerator.java | 5 +- .../GT_MetaTileEntity_AlloySmelter_Bronze.java | 7 +- .../GT_MetaTileEntity_AlloySmelter_Steel.java | 7 +- .../steam/GT_MetaTileEntity_Compressor_Bronze.java | 7 +- .../steam/GT_MetaTileEntity_Compressor_Steel.java | 7 +- .../steam/GT_MetaTileEntity_Extractor_Bronze.java | 7 +- .../steam/GT_MetaTileEntity_Extractor_Steel.java | 7 +- .../GT_MetaTileEntity_ForgeHammer_Bronze.java | 7 +- .../steam/GT_MetaTileEntity_ForgeHammer_Steel.java | 7 +- .../steam/GT_MetaTileEntity_Furnace_Bronze.java | 7 +- .../steam/GT_MetaTileEntity_Furnace_Steel.java | 7 +- .../steam/GT_MetaTileEntity_Macerator_Bronze.java | 13 +- .../steam/GT_MetaTileEntity_Macerator_Steel.java | 13 +- .../gregtech/common/tools/GT_Tool_HardHammer.java | 7 +- .../gregtech/common/tools/GT_Tool_JackHammer.java | 5 +- .../java/gregtech/loaders/load/GT_FuelLoader.java | 31 +- .../gregtech/loaders/load/GT_ItemIterator.java | 30 +- .../load/GT_Loader_MetaTileEntities_Recipes.java | 888 +-- .../gregtech/loaders/misc/GT_Achievements.java | 16 +- .../loaders/oreprocessing/ProcessingArrows.java | 12 +- .../loaders/oreprocessing/ProcessingBeans.java | 4 +- .../loaders/oreprocessing/ProcessingBlock.java | 30 +- .../loaders/oreprocessing/ProcessingCell.java | 20 +- .../loaders/oreprocessing/ProcessingCrafting.java | 106 +- .../loaders/oreprocessing/ProcessingCrate.java | 20 +- .../loaders/oreprocessing/ProcessingCrop.java | 36 +- .../oreprocessing/ProcessingCrushedOre.java | 18 +- .../oreprocessing/ProcessingCrystallized.java | 8 +- .../loaders/oreprocessing/ProcessingDirty.java | 20 +- .../loaders/oreprocessing/ProcessingDust.java | 92 +- .../loaders/oreprocessing/ProcessingDye.java | 6 +- .../loaders/oreprocessing/ProcessingFoil.java | 4 +- .../loaders/oreprocessing/ProcessingFood.java | 24 +- .../loaders/oreprocessing/ProcessingGear.java | 6 +- .../loaders/oreprocessing/ProcessingGem.java | 98 +- .../loaders/oreprocessing/ProcessingIngot.java | 42 +- .../loaders/oreprocessing/ProcessingLens.java | 14 +- .../loaders/oreprocessing/ProcessingLog.java | 72 +- .../loaders/oreprocessing/ProcessingNugget.java | 15 +- .../loaders/oreprocessing/ProcessingOre.java | 22 +- .../loaders/oreprocessing/ProcessingOrePoor.java | 8 +- .../oreprocessing/ProcessingOreSmelting.java | 33 +- .../loaders/oreprocessing/ProcessingPipe.java | 8 +- .../loaders/oreprocessing/ProcessingPlank.java | 30 +- .../loaders/oreprocessing/ProcessingPlate.java | 68 +- .../loaders/oreprocessing/ProcessingPure.java | 8 +- .../loaders/oreprocessing/ProcessingRecycling.java | 4 +- .../loaders/oreprocessing/ProcessingRotor.java | 16 +- .../loaders/oreprocessing/ProcessingRound.java | 4 +- .../loaders/oreprocessing/ProcessingSand.java | 4 +- .../loaders/oreprocessing/ProcessingSaplings.java | 12 +- .../loaders/oreprocessing/ProcessingScrew.java | 4 +- .../loaders/oreprocessing/ProcessingShaping.java | 133 +- .../loaders/oreprocessing/ProcessingSlab.java | 4 +- .../loaders/oreprocessing/ProcessingStick.java | 20 +- .../loaders/oreprocessing/ProcessingStickLong.java | 12 +- .../loaders/oreprocessing/ProcessingStone.java | 76 +- .../oreprocessing/ProcessingStoneCobble.java | 4 +- .../loaders/oreprocessing/ProcessingToolHead.java | 46 +- .../oreprocessing/ProcessingTransforming.java | 24 +- .../loaders/oreprocessing/ProcessingWax.java | 2 - .../loaders/oreprocessing/ProcessingWire.java | 68 +- .../postload/GT_ExtremeDieselFuelLoader.java | 22 - .../gregtech/loaders/postload/GT_PostLoad.java | 221 +- .../postload/GT_ProcessingArrayRecipeLoader.java | 92 +- .../loaders/postload/GT_UUMRecipeLoader.java | 7 - .../postload/chains/GT_BauxiteRefineChain.java | 50 +- .../loaders/postload/chains/GT_NaniteChain.java | 4 +- .../postload/chains/GT_PCBFactoryRecipes.java | 487 +- .../postload/recipes/AlloySmelterRecipes.java | 12 +- .../postload/recipes/ArcFurnaceRecipes.java | 47 + .../loaders/postload/recipes/AssemblerRecipes.java | 1260 ++--- .../loaders/postload/recipes/AutoclaveRecipes.java | 48 +- .../loaders/postload/recipes/BenderRecipes.java | 88 +- .../postload/recipes/BlastFurnaceRecipes.java | 130 +- .../loaders/postload/recipes/BreweryRecipes.java | 118 +- .../loaders/postload/recipes/CannerRecipes.java | 14 +- .../postload/recipes/CentrifugeRecipes.java | 182 +- .../postload/recipes/ChemicalBathRecipes.java | 82 +- .../loaders/postload/recipes/ChemicalRecipes.java | 410 +- .../postload/recipes/CircuitAssemblerRecipes.java | 42 +- .../postload/recipes/CompressorRecipes.java | 36 +- .../postload/recipes/CropProcessingRecipes.java | 8 +- .../loaders/postload/recipes/CuttingRecipes.java | 14 +- .../postload/recipes/DistilleryRecipes.java | 140 +- .../postload/recipes/ElectrolyzerRecipes.java | 62 +- .../recipes/ElectromagneticSeparatorRecipes.java | 6 +- .../loaders/postload/recipes/ExtractorRecipes.java | 4 +- .../loaders/postload/recipes/ExtruderRecipes.java | 6 +- .../loaders/postload/recipes/FermenterRecipes.java | 80 +- .../postload/recipes/FluidCannerRecipes.java | 22 +- .../postload/recipes/FluidExtractorRecipes.java | 171 +- .../postload/recipes/FluidHeaterRecipes.java | 20 +- .../postload/recipes/FluidSolidifierRecipes.java | 130 +- .../postload/recipes/ForgeHammerRecipes.java | 38 +- .../postload/recipes/FormingPressRecipes.java | 40 +- .../loaders/postload/recipes/FuelRecipes.java | 34 - .../postload/recipes/FusionReactorRecipes.java | 72 +- .../recipes/ImplosionCompressorRecipes.java | 14 +- .../postload/recipes/LaserEngraverRecipes.java | 12 +- .../loaders/postload/recipes/LatheRecipes.java | 6 +- .../postload/recipes/MatterAmplifierRecipes.java | 6 +- .../loaders/postload/recipes/MixerRecipes.java | 302 +- .../loaders/postload/recipes/PackagerRecipes.java | 10 +- .../postload/recipes/PlasmaForgeRecipes.java | 6 +- .../loaders/postload/recipes/PrinterRecipes.java | 12 +- .../loaders/postload/recipes/Pulverizer.java | 128 +- .../loaders/postload/recipes/PyrolyseRecipes.java | 26 +- .../loaders/postload/recipes/SifterRecipes.java | 6 +- .../loaders/postload/recipes/SlicerRecipes.java | 10 +- .../postload/recipes/ThermalCentrifugeRecipes.java | 4 +- .../recipes/TranscendentPlasmaMixerRecipes.java | 14 +- .../postload/recipes/VacuumFreezerRecipes.java | 100 +- .../loaders/postload/recipes/WiremillRecipes.java | 18 +- .../preload/GT_Loader_Item_Block_And_Fluid.java | 36 +- .../preload/GT_Loader_MetaTileEntities.java | 9 - .../java/gregtech/loaders/preload/GT_PreLoad.java | 53 +- .../gregtech/nei/FusionSpecialValueFormatter.java | 48 - .../java/gregtech/nei/GT_NEI_AssLineHandler.java | 21 - .../java/gregtech/nei/GT_NEI_DefaultHandler.java | 878 +-- .../nei/HeatingCoilSpecialValueFormatter.java | 22 - src/main/java/gregtech/nei/IMCForNEI.java | 71 - .../gregtech/nei/INEISpecialInfoFormatter.java | 21 - src/main/java/gregtech/nei/NEIRecipeInfo.java | 45 - src/main/java/gregtech/nei/NEI_GT_Config.java | 149 +- .../java/gregtech/nei/NEI_TransferRectHost.java | 14 - src/main/java/gregtech/nei/RecipeDisplayInfo.java | 99 + src/main/java/gregtech/nei/RecipeMapHandler.java | 39 - .../formatter/DefaultSpecialValueFormatter.java | 36 + .../nei/formatter/FuelSpecialValueFormatter.java | 27 + .../nei/formatter/FusionSpecialValueFormatter.java | 59 + .../HeatingCoilSpecialValueFormatter.java | 30 + .../nei/formatter/INEISpecialInfoFormatter.java | 24 + .../nei/formatter/SimpleSpecialValueFormatter.java | 49 + 298 files changed, 12676 insertions(+), 13017 deletions(-) delete mode 100644 src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java create mode 100644 src/main/java/gregtech/api/interfaces/IRecipeMap.java create mode 100644 src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java create mode 100644 src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java create mode 100644 src/main/java/gregtech/api/objects/overclockdescriber/EUNoOverclockDescriber.java create mode 100644 src/main/java/gregtech/api/objects/overclockdescriber/EUOverclockDescriber.java create mode 100644 src/main/java/gregtech/api/objects/overclockdescriber/FusionOverclockDescriber.java create mode 100644 src/main/java/gregtech/api/objects/overclockdescriber/OverclockDescriber.java create mode 100644 src/main/java/gregtech/api/objects/overclockdescriber/SteamOverclockDescriber.java create mode 100644 src/main/java/gregtech/api/recipe/BasicUIProperties.java create mode 100644 src/main/java/gregtech/api/recipe/BasicUIPropertiesBuilder.java create mode 100644 src/main/java/gregtech/api/recipe/FindRecipeQuery.java create mode 100644 src/main/java/gregtech/api/recipe/NEIRecipeProperties.java create mode 100644 src/main/java/gregtech/api/recipe/NEIRecipePropertiesBuilder.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeCategories.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeCategory.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeCategoryHolder.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeCategorySetting.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMap.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMapBackend.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMapBackendProperties.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMapBackendPropertiesBuilder.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMapBuilder.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMapFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMaps.java create mode 100644 src/main/java/gregtech/api/recipe/RecipeMetadataKey.java delete mode 100644 src/main/java/gregtech/api/recipe/check/FindRecipeResult.java delete mode 100644 src/main/java/gregtech/api/recipe/check/RecipeValidator.java create mode 100644 src/main/java/gregtech/api/recipe/maps/AssemblerBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/AssemblyLineFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/DistillationTowerFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/FluidCannerBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/FluidOnlyFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/FormingPressBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/FuelBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/FurnaceBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/LargeBoilerFuelBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/LargeBoilerFuelFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/LargeNEIFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/MicrowaveBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/NonGTBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/OilCrackerBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/PrinterBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/RecyclerBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/ReplicatorBackend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/SpaceProjectFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/TranscendentPlasmaMixerFrontend.java create mode 100644 src/main/java/gregtech/api/recipe/maps/UnpackagerBackend.java create mode 100644 src/main/java/gregtech/api/recipe/metadata/EmptyRecipeMetadataStorage.java create mode 100644 src/main/java/gregtech/api/recipe/metadata/IRecipeMetadataStorage.java create mode 100644 src/main/java/gregtech/api/recipe/metadata/PCBFactoryTierKey.java create mode 100644 src/main/java/gregtech/api/recipe/metadata/PCBFactoryUpgrade.java create mode 100644 src/main/java/gregtech/api/recipe/metadata/PCBFactoryUpgradeKey.java create mode 100644 src/main/java/gregtech/api/recipe/metadata/RecipeMetadataStorage.java create mode 100644 src/main/java/gregtech/api/recipe/metadata/SimpleRecipeMetadataKey.java create mode 100644 src/main/java/gregtech/api/util/FieldsAreNonnullByDefault.java create mode 100644 src/main/java/gregtech/api/util/GT_StreamUtil.java create mode 100644 src/main/java/gregtech/api/util/MethodsReturnNonnullByDefault.java delete mode 100644 src/main/java/gregtech/common/power/BasicMachineEUPower.java delete mode 100644 src/main/java/gregtech/common/power/EUPower.java delete mode 100644 src/main/java/gregtech/common/power/FusionPower.java delete mode 100644 src/main/java/gregtech/common/power/Power.java delete mode 100644 src/main/java/gregtech/common/power/SteamPower.java delete mode 100644 src/main/java/gregtech/common/power/UnspecifiedEUPower.java delete mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java delete mode 100644 src/main/java/gregtech/loaders/postload/GT_ExtremeDieselFuelLoader.java delete mode 100644 src/main/java/gregtech/loaders/postload/GT_UUMRecipeLoader.java delete mode 100644 src/main/java/gregtech/nei/FusionSpecialValueFormatter.java delete mode 100644 src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java delete mode 100644 src/main/java/gregtech/nei/HeatingCoilSpecialValueFormatter.java delete mode 100644 src/main/java/gregtech/nei/IMCForNEI.java delete mode 100644 src/main/java/gregtech/nei/INEISpecialInfoFormatter.java delete mode 100644 src/main/java/gregtech/nei/NEIRecipeInfo.java delete mode 100644 src/main/java/gregtech/nei/NEI_TransferRectHost.java create mode 100644 src/main/java/gregtech/nei/RecipeDisplayInfo.java delete mode 100644 src/main/java/gregtech/nei/RecipeMapHandler.java create mode 100644 src/main/java/gregtech/nei/formatter/DefaultSpecialValueFormatter.java create mode 100644 src/main/java/gregtech/nei/formatter/FuelSpecialValueFormatter.java create mode 100644 src/main/java/gregtech/nei/formatter/FusionSpecialValueFormatter.java create mode 100644 src/main/java/gregtech/nei/formatter/HeatingCoilSpecialValueFormatter.java create mode 100644 src/main/java/gregtech/nei/formatter/INEISpecialInfoFormatter.java create mode 100644 src/main/java/gregtech/nei/formatter/SimpleSpecialValueFormatter.java (limited to 'src/main/java') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index b1146a10bb..59ee674e75 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -31,6 +31,7 @@ import org.apache.logging.log4j.LogManager; 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; @@ -63,6 +64,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity; 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; @@ -100,7 +102,6 @@ import gregtech.loaders.postload.GT_BlockResistanceLoader; 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; @@ -118,7 +119,6 @@ import gregtech.loaders.preload.GT_Loader_MultiTileEntities; 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; @@ -362,7 +362,6 @@ public class GT_Mod implements IGT_Mod { 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!"); @@ -522,7 +521,6 @@ public class GT_Mod implements IGT_Mod { .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 @@ -579,6 +577,7 @@ public class GT_Mod implements IGT_Mod { @Mod.EventHandler public void onLoadComplete(FMLLoadCompleteEvent aEvent) { + gregtechproxy.onLoadComplete(); for (Runnable tRunnable : GregTech_API.sGTCompleteLoad) { try { tRunnable.run(); @@ -612,33 +611,17 @@ public class GT_Mod implements IGT_Mod { 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); @@ -814,6 +797,9 @@ public class GT_Mod implements IGT_Mod { for (Map gt_itemStackMap : GregTech_API.sItemStackMappings) { GT_Utility.reMap(gt_itemStackMap); } + for (SetMultimap gt_itemStackMap : GregTech_API.itemStackMultiMaps) { + GT_Utility.reMap(gt_itemStackMap); + } } catch (Throwable e) { e.printStackTrace(GT_Log.err); } diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index 6848c66a38..c5e27aebca 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -36,6 +36,7 @@ import net.minecraft.world.World; 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; @@ -107,6 +108,7 @@ public class GregTech_API { * Fixes the HashMap Mappings for ItemStacks once the Server started */ public static final Collection> sItemStackMappings = new ArrayList<>(); + public static final Collection> itemStackMultiMaps = new ArrayList<>(); /** * The MetaTileEntity-ID-List-Length @@ -121,17 +123,36 @@ public class GregTech_API { /** * A List of all registered MetaTileEntities *

- * 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. *

* 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 diff --git a/src/main/java/gregtech/api/enums/Element.java b/src/main/java/gregtech/api/enums/Element.java index a0f8e6c0b1..0931663b0b 100644 --- a/src/main/java/gregtech/api/enums/Element.java +++ b/src/main/java/gregtech/api/enums/Element.java @@ -4,6 +4,8 @@ import java.util.ArrayList; 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. */ @@ -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); } diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index ed2cad0ce1..5ecf39a722 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -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, diff --git a/src/main/java/gregtech/api/enums/MachineType.java b/src/main/java/gregtech/api/enums/MachineType.java index 7868d80f8f..14e1781350 100644 --- a/src/main/java/gregtech/api/enums/MachineType.java +++ b/src/main/java/gregtech/api/enums/MachineType.java @@ -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"), @@ -62,7 +62,7 @@ public enum MachineType { 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"; diff --git a/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java b/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java index ace5f620d4..3994a02085 100644 --- a/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java +++ b/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java @@ -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), diff --git a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java index 1a47e41e8c..1dd7c9f6d2 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java @@ -7,6 +7,7 @@ import java.util.stream.Collectors; 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 { @@ -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"); @@ -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"); diff --git a/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java b/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java deleted file mode 100644 index 2c5259882a..0000000000 --- a/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java +++ /dev/null @@ -1,74 +0,0 @@ -package gregtech.api.interfaces; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.function.Function; - -import javax.annotation.Nonnull; - -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_RecipeBuilder; -import gregtech.api.util.GT_Utility; - -/** - * Represents the target of a recipe adding action, usually, but not necessarily, is a recipe map itself. - */ -public interface IGT_RecipeMap { - - /** - * Add a downstream recipe map that will get to handle the original builder. - *

- * Downstream recipe maps got passed the recipe builder after parent recipe map is done with its business. Notice - * at this time the original recipe builder might be modified by the parent recipe map in some form, but it will - * remain as valid. - *

- * A downstream will only be invoked if parent recipe map added something. - * - * @param downstream the downstream recipe map to add - */ - void addDownstream(IGT_RecipeMap downstream); - - /** - * Actually add the recipe represented by the builder. CAN modify the builder's internal states!!! - */ - @Nonnull - Collection doAdd(GT_RecipeBuilder builder); - - /** - * Return a variant of this recipe map that will perform a deep copy on input recipe builder before doing anything - * to it. - *

- * The returned recipe map will not have any downstreams, but can accept new downstreams. - */ - default IGT_RecipeMap deepCopyInput() { - return newRecipeMap(b -> doAdd(b.copy())); - } - - static IGT_RecipeMap newRecipeMap(Function> func) { - return new IGT_RecipeMap() { - - private final Collection downstreams = new ArrayList<>(); - - @Override - public void addDownstream(IGT_RecipeMap downstream) { - downstreams.add(downstream); - } - - @Nonnull - @Override - public Collection doAdd(GT_RecipeBuilder builder) { - List> ret = new ArrayList<>(); - Collection out = func.apply(builder); - ret.add(out); - builder.clearInvalid(); - if (!out.isEmpty()) { - for (IGT_RecipeMap downstream : downstreams) { - ret.add(downstream.doAdd(builder)); - } - } - return GT_Utility.concat(ret); - } - }; - } -} diff --git a/src/main/java/gregtech/api/interfaces/IRecipeMap.java b/src/main/java/gregtech/api/interfaces/IRecipeMap.java new file mode 100644 index 0000000000..ce48b29927 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IRecipeMap.java @@ -0,0 +1,74 @@ +package gregtech.api.interfaces; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.function.Function; + +import javax.annotation.Nonnull; + +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_RecipeBuilder; +import gregtech.api.util.GT_Utility; + +/** + * Represents the target of a recipe adding action, usually, but not necessarily, is a recipe map itself. + */ +public interface IRecipeMap { + + /** + * Add a downstream recipe map that will get to handle the original builder. + *

+ * Downstream recipe maps got passed the recipe builder after parent recipe map is done with its business. Notice + * at this time the original recipe builder might be modified by the parent recipe map in some form, but it will + * remain as valid. + *

+ * A downstream will only be invoked if parent recipe map added something. + * + * @param downstream the downstream recipe map to add + */ + void addDownstream(IRecipeMap downstream); + + /** + * Actually add the recipe represented by the builder. CAN modify the builder's internal states!!! + */ + @Nonnull + Collection doAdd(GT_RecipeBuilder builder); + + /** + * Return a variant of this recipe map that will perform a deep copy on input recipe builder before doing anything + * to it. + *

+ * The returned recipe map will not have any downstreams, but can accept new downstreams. + */ + default IRecipeMap deepCopyInput() { + return newRecipeMap(b -> doAdd(b.copy())); + } + + static IRecipeMap newRecipeMap(Function> func) { + return new IRecipeMap() { + + private final Collection downstreams = new ArrayList<>(); + + @Override + public void addDownstream(IRecipeMap downstream) { + downstreams.add(downstream); + } + + @Nonnull + @Override + public Collection doAdd(GT_RecipeBuilder builder) { + List> ret = new ArrayList<>(); + Collection out = func.apply(builder); + ret.add(out); + builder.clearInvalid(); + if (!out.isEmpty()) { + for (IRecipeMap downstream : downstreams) { + ret.add(downstream.doAdd(builder)); + } + } + return GT_Utility.concat(ret); + } + }; + } +} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index 361e391a9b..e7abfea98f 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -320,17 +320,6 @@ public interface IGT_RecipeAdder { boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean hidden); - /** - * Adds a CNC-Machine Recipe - * - * @param aInput1 must be != null - * @param aOutput1 must be != null - * @param aDuration must be > 0 - * @param aEUt should be > 0 - */ - @Deprecated - boolean addCNCRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); - /** * Adds an Assembler Recipe * @@ -1046,21 +1035,6 @@ public interface IGT_RecipeAdder { boolean addNanoForgeRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int[] aChances, int aDuration, int aEUt, int aSpecialValue); - /** - * Add a Board Manufacturer Recipe. The Board Manufacturer's main use is to make the circuit boards needed to make - * circuits. - * - * @param aInputs must not be null - * @param aFluidInputs must not be null - * @param aOutputs must not be null - * @param aDuration recipe duration - * @param aEUt recipe EU/t expenditure - * @param aSpecialValue defines the tier of the board manufacturer required. - */ - @Deprecated - boolean addPCBFactoryRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, int aDuration, - int aEUt, int aSpecialValue); - /** * Add a breeder cell. * diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index ba164352aa..04522b1012 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -38,7 +38,6 @@ import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Util; -import gregtech.common.power.Power; /** * Warning, this Interface has just been made to be able to add multiple kinds of MetaTileEntities (Cables, Pipes, @@ -365,13 +364,6 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand */ String getSpecialVoltageToolTip(); - /** - * @return Power object used for displaying in NEI - */ - default Power getPower() { - return null; - } - /** * Icon of the Texture. If this returns null then it falls back to getTextureIndex. * diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java b/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java new file mode 100644 index 0000000000..495cd9def4 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java @@ -0,0 +1,15 @@ +package gregtech.api.interfaces.tileentity; + +import javax.annotation.Nullable; + +import gregtech.api.objects.overclockdescriber.OverclockDescriber; + +/** + * Classes implementing this interface can provide {@link OverclockDescriber} to provide overclock behavior and NEI + * description. + */ +public interface IOverclockDescriptionProvider { + + @Nullable + OverclockDescriber getOverclockDescriber(); +} diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java b/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java index f793221a50..54d178af3c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java @@ -1,12 +1,11 @@ package gregtech.api.interfaces.tileentity; import gregtech.api.recipe.check.SingleRecipeCheck; -import gregtech.api.util.GT_Recipe; /** * Machines implementing this interface can have logic to lock to a single recipe. */ -public interface IRecipeLockable { +public interface IRecipeLockable extends RecipeMapWorkable { /** * @return if this machine supports single recipe locking. @@ -29,6 +28,4 @@ public interface IRecipeLockable { } default void setSingleRecipeCheck(SingleRecipeCheck recipeCheck) {} - - GT_Recipe.GT_Recipe_Map getRecipeMap(); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java b/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java new file mode 100644 index 0000000000..7d4db4396c --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java @@ -0,0 +1,49 @@ +package gregtech.api.interfaces.tileentity; + +import java.util.Collection; +import java.util.Collections; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; + +import gregtech.api.recipe.RecipeMap; + +/** + * Machines implementing this interface are capable of executing certain recipes provided by {@link RecipeMap}. + * They will also be automatically registered as NEI recipe catalyst for the corresponding recipemaps. + */ +public interface RecipeMapWorkable { + + /** + * @return RecipeMap this machine currently can execute. In general, it's allowed to be null. + */ + RecipeMap getRecipeMap(); + + /** + * @return ItemStack form of this machine. + */ + ItemStack getStackForm(long amount); + + /** + * If the machine supports multiple recipemaps by switching mode, override this method so that it will be displayed + * as NEI recipe catalyst on all the supported recipemaps. + * + * @return List of possible {@link RecipeMap}s this machine can execute. Must not contain null element. + */ + @Nonnull + default Collection> getAvailableRecipeMaps() { + RecipeMap recipeMap = getRecipeMap(); + if (recipeMap != null) { + return Collections.singletonList(recipeMap); + } + return Collections.emptyList(); + } + + /** + * @return Priority for NEI recipe catalyst. Higher priority comes first. + */ + default int getRecipeCatalystPriority() { + return 0; + } +} diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java index 828fab4368..465c4bc9d6 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -3,7 +3,7 @@ package gregtech.api.items; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.Mods.AppleCore; import static gregtech.api.enums.Mods.GregTech; -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sCannerRecipes; +import static gregtech.api.recipe.RecipeMaps.cannerRecipes; import static gregtech.api.util.GT_RecipeBuilder.SECONDS; import java.util.ArrayList; @@ -153,7 +153,7 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements : ItemList.IC2_Food_Can_Filled.get(tFoodValue)) .duration(tFoodValue * 5 * SECONDS) .eut(1) - .addTo(sCannerRecipes); + .addTo(cannerRecipes); } } tUseOreDict = false; diff --git a/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java b/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java index 05d39cd02c..3c7974db9e 100644 --- a/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java @@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import gregtech.api.multitileentity.multiblock.base.Controller; +import gregtech.api.recipe.RecipeMap; import gregtech.api.util.GT_OverclockCalculator; import gregtech.api.util.GT_ParallelHelper; import gregtech.api.util.GT_Recipe; @@ -13,7 +14,7 @@ import gregtech.api.util.GT_Recipe; public class ComplexParallelProcessingLogic { protected Controller tileEntity; - protected GT_Recipe.GT_Recipe_Map recipeMap; + protected RecipeMap recipeMap; protected boolean hasPerfectOverclock; protected final int maxComplexParallels; protected final ItemStack[][] outputItems; @@ -30,7 +31,7 @@ public class ComplexParallelProcessingLogic { this(null, maxComplexParallels); } - public ComplexParallelProcessingLogic(GT_Recipe.GT_Recipe_Map recipeMap, int maxComplexParallels) { + public ComplexParallelProcessingLogic(RecipeMap recipeMap, int maxComplexParallels) { this.maxComplexParallels = maxComplexParallels; this.recipeMap = recipeMap; inputItems = new ItemStack[maxComplexParallels][]; @@ -44,7 +45,7 @@ public class ComplexParallelProcessingLogic { isFluidVoidProtected = new boolean[maxComplexParallels]; } - public ComplexParallelProcessingLogic setRecipeMap(GT_Recipe.GT_Recipe_Map recipeMap) { + public ComplexParallelProcessingLogic setRecipeMap(RecipeMap recipeMap) { this.recipeMap = recipeMap; return this; } diff --git a/src/main/java/gregtech/api/logic/ProcessingLogic.java b/src/main/java/gregtech/api/logic/ProcessingLogic.java index 803abafbe3..6b9f2d454f 100644 --- a/src/main/java/gregtech/api/logic/ProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/ProcessingLogic.java @@ -2,6 +2,7 @@ package gregtech.api.logic; import java.util.List; import java.util.function.Supplier; +import java.util.stream.Stream; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -13,15 +14,13 @@ import org.jetbrains.annotations.NotNull; import gregtech.api.interfaces.tileentity.IRecipeLockable; import gregtech.api.interfaces.tileentity.IVoidable; +import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.FindRecipeResult; -import gregtech.api.recipe.check.RecipeValidator; import gregtech.api.recipe.check.SingleRecipeCheck; import gregtech.api.util.GT_OverclockCalculator; import gregtech.api.util.GT_ParallelHelper; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; /** * Logic class to calculate result of recipe check from inputs, based on recipemap. @@ -31,9 +30,9 @@ public class ProcessingLogic { protected IVoidable machine; protected IRecipeLockable recipeLockableMachine; - protected Supplier recipeMapSupplier; + protected Supplier> recipeMapSupplier; protected GT_Recipe lastRecipe; - protected GT_Recipe_Map lastRecipeMap; + protected RecipeMap lastRecipeMap; protected ItemStack specialSlotItem; protected ItemStack[] inputItems; protected ItemStack[] outputItems; @@ -146,11 +145,11 @@ public class ProcessingLogic { return this; } - public ProcessingLogic setRecipeMap(GT_Recipe_Map recipeMap) { + public ProcessingLogic setRecipeMap(RecipeMap recipeMap) { return setRecipeMapSupplier(() -> recipeMap); } - public ProcessingLogic setRecipeMapSupplier(Supplier supplier) { + public ProcessingLogic setRecipeMapSupplier(Supplier> supplier) { this.recipeMapSupplier = supplier; return this; } @@ -263,7 +262,7 @@ public class ProcessingLogic { */ @Nonnull public CheckRecipeResult process() { - GT_Recipe_Map recipeMap; + RecipeMap recipeMap; if (recipeMapSupplier == null) { recipeMap = null; } else { @@ -278,6 +277,13 @@ public class ProcessingLogic { maxParallel = maxParallelSupplier.get(); } + if (inputItems == null) { + inputItems = new ItemStack[0]; + } + if (inputFluids == null) { + inputFluids = new FluidStack[0]; + } + if (isRecipeLocked && recipeLockableMachine != null && recipeLockableMachine.getSingleRecipeCheck() != null) { // Recipe checker is already built, we'll use it SingleRecipeCheck singleRecipeCheck = recipeLockableMachine.getSingleRecipeCheck(); @@ -287,55 +293,39 @@ public class ProcessingLogic { return CheckRecipeResultRegistry.NO_RECIPE; } - return processRecipe( + return validateAndCalculateRecipe( recipeLockableMachine.getSingleRecipeCheck() - .getRecipe()); + .getRecipe()).checkRecipeResult; } - FindRecipeResult findRecipeResult = findRecipe(recipeMap); - // If processRecipe is not overridden, advanced recipe validation logic is used, and we can reuse calculations. - if (findRecipeResult.hasRecipeValidator()) { - RecipeValidator recipeValidator = findRecipeResult.getRecipeValidator(); - - // There are two cases: - // 1 - there are actually no matching recipes - // 2 - there are some matching recipes, but we rejected it due to our advanced validation (e.g. OUTPUT_FULL) - if (findRecipeResult.getState() == FindRecipeResult.State.NOT_FOUND - && recipeValidator.getFirstCheckResult() != null) { - // Here we're handling case 2 - // If there are matching recipes but our validation rejected them, - // we should return a first one to display a proper error in the machine GUI - return recipeValidator.getFirstCheckResult(); + Stream matchedRecipes = findRecipeMatches(recipeMap); + Iterable recipeIterable = matchedRecipes::iterator; + CheckRecipeResult checkRecipeResult = CheckRecipeResultRegistry.NO_RECIPE; + for (GT_Recipe matchedRecipe : recipeIterable) { + CalculationResult foundResult = validateAndCalculateRecipe(matchedRecipe); + if (foundResult.successfullyConsumedInputs) { + // Successfully found and set recipe, so return it + return foundResult.checkRecipeResult; } - - // If everything is ok, reuse our calculations - if (recipeValidator.isExecutedAtLeastOnce() && findRecipeResult.isSuccessful()) { - return applyRecipe( - findRecipeResult.getRecipeNonNull(), - recipeValidator.getLast