diff options
Diffstat (limited to 'src/main/java/bartworks/common/loaders/FluidLoader.java')
-rw-r--r-- | src/main/java/bartworks/common/loaders/FluidLoader.java | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/src/main/java/bartworks/common/loaders/FluidLoader.java b/src/main/java/bartworks/common/loaders/FluidLoader.java new file mode 100644 index 0000000000..b5f8283aa0 --- /dev/null +++ b/src/main/java/bartworks/common/loaders/FluidLoader.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following + * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +package bartworks.common.loaders; + +import static gregtech.api.enums.Mods.Gendustry; +import static gregtech.api.enums.Mods.GregTech; +import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; + +import java.awt.Color; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import bartworks.API.SideReference; +import bartworks.client.renderer.RendererGlassBlock; +import bartworks.client.renderer.RendererSwitchingColorFluid; +import bartworks.common.blocks.BlockBioFluid; +import bartworks.common.tileentities.classic.TileEntityDimIDBridge; +import bartworks.util.BioCulture; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.FluidState; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TierEU; +import gregtech.api.fluid.GTFluidFactory; +import gregtech.api.util.GTUtility; +import gregtech.common.items.MetaGeneratedItem98; + +public class FluidLoader { + + public static IIcon autogenIIcon; + public static Fluid ff; + public static int renderID; + public static Block bioFluidBlock; + public static Fluid[] BioLabFluidMaterials; + public static ItemStack[] BioLabFluidCells; + + // OilProcessing chain + public static Fluid fulvicAcid, heatedfulvicAcid, Kerogen; + + public static void run() { + renderID = RenderingRegistry.getNextAvailableRenderId(); + ff = new Fluid("BWfakeFluid"); + GregTechAPI.sGTBlockIconload.add( + () -> ff.setIcons( + GregTechAPI.sBlockIcons + .registerIcon(GregTech.getResourcePath("fluids", "fluid.molten.autogenerated")))); + fulvicAcid = createAndRegisterFluid("Fulvic Acid", new Color(20, 20, 20)); + heatedfulvicAcid = createAndRegisterFluid("Heated Fulvic Acid", new Color(40, 20, 20), 720); + Kerogen = createAndRegisterFluid("Kerogen", new Color(85, 85, 85)); + BioLabFluidMaterials = new Fluid[] { createAndRegisterFluid("FluorecentdDNA", new Color(125, 50, 170)), + createAndRegisterFluid("EnzymesSollution", new Color(240, 200, 125)), + createAndRegisterFluid("Penicillin", new Color(255, 255, 255)), + createAndRegisterFluid("Polymerase", new Color(110, 180, 110)) }; + + BioLabFluidCells = new ItemStack[BioLabFluidMaterials.length]; + + MetaGeneratedItem98.FluidCell[] fluidCells = { MetaGeneratedItem98.FluidCell.FLUORESCENT_DNA, + MetaGeneratedItem98.FluidCell.ENZYME_SOLUTION, MetaGeneratedItem98.FluidCell.PENICILLIN, + MetaGeneratedItem98.FluidCell.POLYMERASE, }; + for (int i = 0; i < fluidCells.length; i++) { + BioLabFluidCells[i] = fluidCells[i].get(); + } + + FluidStack dnaFluid = Gendustry.isModLoaded() ? FluidRegistry.getFluidStack("liquiddna", 100) + : Materials.Biomass.getFluid(100L); + for (BioCulture B : BioCulture.BIO_CULTURE_ARRAY_LIST) { + if (B.isBreedable()) { + B.setFluid( + GTFluidFactory.builder( + B.getName() + .replace(" ", "") + .toLowerCase() + "fluid") + .withTextureName("molten.autogenerated") + .withColorRGBA( + new short[] { (short) B.getColor() + .getRed(), + (short) B.getColor() + .getBlue(), + (short) B.getColor() + .getGreen() }) + .withLocalizedName(B.getLocalisedName() + " Fluid") + .withStateAndTemperature(FluidState.LIQUID, 300) + .buildAndRegister() + .asFluid()); + + GTValues.RA.stdBuilder() + .itemInputs(GTUtility.getIntegratedCircuit(10)) + .fluidInputs(new FluidStack(B.getFluid(), 1000)) + .fluidOutputs(dnaFluid) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_MV) + .addTo(centrifugeRecipes); + } + } + + bioFluidBlock = new BlockBioFluid(); + GameRegistry.registerBlock(bioFluidBlock, "coloredFluidBlock"); + GameRegistry.registerTileEntity(TileEntityDimIDBridge.class, "bwTEDimIDBridge"); + if (SideReference.Side.Client) { + RendererSwitchingColorFluid.register(); + RendererGlassBlock.register(); + } + } + + public static Fluid createAndRegisterFluid(String Name, Color color) { + return GTFluidFactory.builder(Name) + .withTextureName("molten.autogenerated") + .withColorRGBA( + new short[] { (short) color.getRed(), (short) color.getGreen(), (short) color.getBlue(), + (short) color.getAlpha() }) + .withStateAndTemperature(FluidState.LIQUID, 300) + .buildAndRegister() + .asFluid(); + } + + public static Fluid createAndRegisterFluid(String Name, Color color, int temperature) { + return GTFluidFactory.builder(Name) + .withTextureName("molten.autogenerated") + .withColorRGBA( + new short[] { (short) color.getRed(), (short) color.getGreen(), (short) color.getBlue(), + (short) color.getAlpha() }) + .withStateAndTemperature(FluidState.LIQUID, temperature) + .buildAndRegister() + .asFluid(); + } +} |