From 7caea6daefcbffbc102741ed09daac9d6439824d Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Mon, 5 Sep 2022 17:43:09 +0200 Subject: feat(API): Implements a featured API for GT_Fluid (#1345) * feat(API): Implements a featured API for GT_Fluid *** Rationale The current implementation, which is based on the `GT_Fluid` object, does not allow for the evolution of the functionalities, or the variation of the fluid-related implementations in GregTech. *** Objectives This replacement API should free from these constraints, by providing : 1. The separation of responsibilities of the different tasks and steps: - The definition and progressive construction of an `IGT_Fluid`, - Registration of the `IGT_Fluid`, - Configuration of related equipment, such as containers, - Propagation of properties of an `IGT_Fluid` to related services such as Materials 2. The separation of interfaces exposed to the API from their internal implementations to allow: - Evolve the implementations in the most transparent way possible - To have internal GregTech implementations or outsourced implementations coexist in its extensions. *** Specificity of this new API - Provides a new interface to build and interact with fluid related records - Deprecates the old `api/objects/GT_Fluid` object and the `common/GT_Proxy.addFluid` record methods * fix(conversations): addresses @Glease review comments https://github.com/GTNewHorizons/GT5-Unofficial/pull/1345#pullrequestreview-1096261703 * ./gradlew :spotlessApply * fix(review): add review comments from @eigenraven Added missing final qualifiers on methods parameters. https://github.com/GTNewHorizons/GT5-Unofficial/pull/1345#pullrequestreview-1096318523 * fix(review) address remaining review comments from @eigenraven --- src/main/java/gregtech/loaders/load/GT_FuelLoader.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/main/java/gregtech/loaders/load') diff --git a/src/main/java/gregtech/loaders/load/GT_FuelLoader.java b/src/main/java/gregtech/loaders/load/GT_FuelLoader.java index 463f2fff63..d6d3373248 100644 --- a/src/main/java/gregtech/loaders/load/GT_FuelLoader.java +++ b/src/main/java/gregtech/loaders/load/GT_FuelLoader.java @@ -1,10 +1,12 @@ package gregtech.loaders.load; -import gregtech.GT_Mod; +import static gregtech.api.enums.FluidState.LIQUID; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.fluid.GT_FluidFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; @@ -12,20 +14,20 @@ import gregtech.api.util.GT_Recipe; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; public class GT_FuelLoader implements Runnable { @Override public void run() { GT_Log.out.println("GT_Mod: Initializing various Fuels."); ItemList.sBlueVitriol = - GT_Mod.gregtechproxy.addFluid("solution.bluevitriol", "Blue Vitriol water solution", null, 1, 295); + (Fluid) GT_FluidFactory.of("solution.bluevitriol", "Blue Vitriol water solution", LIQUID, 295); ItemList.sNickelSulfate = - GT_Mod.gregtechproxy.addFluid("solution.nickelsulfate", "Nickel sulfate water solution", null, 1, 295); - ItemList.sIndiumConcentrate = GT_Mod.gregtechproxy.addFluid( - "indiumconcentrate", "Indium Concentrate", null, 1, 295); // TODO CHECK NEW x3 - ItemList.sLeadZincSolution = - GT_Mod.gregtechproxy.addFluid("leadzincsolution", "Lead-Zinc solution", null, 1, 295); - ItemList.sRocketFuel = GT_Mod.gregtechproxy.addFluid("rocket_fuel", "Rocket Fuel", null, 1, 295); + (Fluid) GT_FluidFactory.of("solution.nickelsulfate", "Nickel sulfate water solution", LIQUID, 295); + ItemList.sIndiumConcentrate = + (Fluid) GT_FluidFactory.of("indiumconcentrate", "Indium Concentrate", LIQUID, 295); // TODO CHECK NEW x3 + ItemList.sLeadZincSolution = (Fluid) GT_FluidFactory.of("leadzincsolution", "Lead-Zinc solution", LIQUID, 295); + ItemList.sRocketFuel = (Fluid) GT_FluidFactory.of("rocket_fuel", "Rocket Fuel", LIQUID, 295); new GT_Recipe( new ItemStack(Items.lava_bucket), new ItemStack(Blocks.obsidian), -- cgit