Java Code Examples for net.minecraftforge.fluids.FluidRegistry#registerFluid()

The following examples show how to use net.minecraftforge.fluids.FluidRegistry#registerFluid() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FluidBase.java    From EmergingTechnology with MIT License 5 votes vote down vote up
public FluidBase(String fluidName, boolean canBeStill) {
	super(fluidName, stillTextureLocation(fluidName, canBeStill), flowingTextureLocation(fluidName, canBeStill));
	
	if (FluidRegistry.registerFluid(this)) {
		FluidRegistry.addBucketForFluid(this);
	}
}
 
Example 2
Source File: FluidBase.java    From EmergingTechnology with MIT License 5 votes vote down vote up
public FluidBase(String fluidName, boolean canBeStill, String textureName, Integer color) {
	super(fluidName, stillTextureLocation(textureName, canBeStill), flowingTextureLocation(textureName, canBeStill));
	
	// int fixedColor = color.intValue();
	// if (((fixedColor >> 24) & 0xFF) == 0) {
	// 	fixedColor |= 0xFF << 24;
	// }
	// setColor(fixedColor);
	
	if (FluidRegistry.registerFluid(this)) {
		FluidRegistry.addBucketForFluid(this);
	}
}
 
Example 3
Source File: BioObjectAdder.java    From bartworks with MIT License 5 votes vote down vote up
/**
 * If you get NPE's related to BioCultures (most likely because of Load Order or creating BioCultures after the postinit Phase) execute this.
 */
public static void regenerateBioFluids() {
    FluidStack dnaFluid = LoaderReference.gendustry ? FluidRegistry.getFluidStack("liquiddna", 100) : Materials.Biomass.getFluid(100L);
    for (BioCulture B : BioCulture.BIO_CULTURE_ARRAY_LIST) {
        if (B.getFluidNotSet()) {
            B.setFluid(new GT_Fluid(B.getName().replaceAll(" ", "").toLowerCase() + "fluid", "molten.autogenerated", new short[]{(short) B.getColor().getRed(), (short) B.getColor().getBlue(), (short) B.getColor().getGreen()}));
            if (!FluidRegistry.registerFluid(B.getFluid()))
                new Exception("FAILED TO REGISTER FLUID FOR: " + B.getName()).printStackTrace();
            GT_Values.RA.addCentrifugeRecipe(GT_Utility.getIntegratedCircuit(10),GT_Values.NI,new FluidStack(B.getFluid(),1000),dnaFluid,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,null,500,120);
        }
    }
}
 
Example 4
Source File: FluidLoader.java    From bartworks with MIT License 5 votes vote down vote up
public static void run() {
        FluidLoader.renderID = RenderingRegistry.getNextAvailableRenderId();
        short[] rgb = new short[3];
        Arrays.fill(rgb, (short) 255);
        FluidLoader.ff = new GT_Fluid("BWfakeFluid", "molten.autogenerated", rgb);
        FluidLoader.fulvicAcid = FluidLoader.createAndRegisterFluid("Fulvic Acid", new Color(20, 20, 20));
        FluidLoader.heatedfulvicAcid = FluidLoader.createAndRegisterFluid("Heated Fulvic Acid", new Color(40, 20, 20),720);
        FluidLoader.Kerogen = FluidLoader.createAndRegisterFluid("Kerogen", new Color(85, 85, 85));
        FluidLoader.BioLabFluidMaterials = new Fluid[]{
                new GT_Fluid("FluorecentdDNA", "molten.autogenerated", new short[]{125, 50, 170, 0}),
                new GT_Fluid("EnzymesSollution", "molten.autogenerated", new short[]{240, 200, 125, 0}),
                new GT_Fluid("Penicillin", "molten.autogenerated", new short[]{255, 255, 255, 0}),
                new GT_Fluid("Polymerase", "molten.autogenerated", new short[]{110, 180, 110, 0}),
        };

        FluidLoader.BioLabFluidCells = new ItemStack[FluidLoader.BioLabFluidMaterials.length];
        for (int i = 0; i < FluidLoader.BioLabFluidMaterials.length; i++) {
            FluidRegistry.registerFluid(FluidLoader.BioLabFluidMaterials[i]);
            FluidLoader.BioLabFluidCells[i] = ItemFluidCell.getUniversalFluidCell(new FluidStack(FluidLoader.BioLabFluidMaterials[i], 1000));
        }

//        BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).setFluid(new GT_Fluid("_NULL", "molten.autogenerated", BW_Util.splitColorToRBGArray(BioCulture.BIO_CULTURE_ARRAY_LIST.get(0).getColorRGB())));
        FluidStack dnaFluid = LoaderReference.gendustry ? FluidRegistry.getFluidStack("liquiddna", 100) : Materials.Biomass.getFluid(100L);
        for (BioCulture B : BioCulture.BIO_CULTURE_ARRAY_LIST) {
            if (B.isBreedable()) {
                B.setFluid(new GT_Fluid(B.getName().replaceAll(" ", "").toLowerCase() + "fluid", "molten.autogenerated", new short[]{(short) B.getColor().getRed(), (short) B.getColor().getBlue(), (short) B.getColor().getGreen()}));
                FluidRegistry.registerFluid(B.getFluid());
                GT_LanguageManager.addStringLocalization(B.getFluid().getUnlocalizedName(), B.getLocalisedName()+" Fluid");
                GT_Values.RA.addCentrifugeRecipe(GT_Utility.getIntegratedCircuit(10),GT_Values.NI,new FluidStack(B.getFluid(),1000),dnaFluid,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,GT_Values.NI,null,500,120);
            }
        }

        FluidLoader.bioFluidBlock = new BioFluidBlock();
        GameRegistry.registerBlock(FluidLoader.bioFluidBlock, "coloredFluidBlock");
        GameRegistry.registerTileEntity(BWTileEntityDimIDBridge.class, "bwTEDimIDBridge");
        if (SideReference.Side.Client) {
            RenderingRegistry.registerBlockHandler(RendererSwitchingColorFluid.instance);
            RenderingRegistry.registerBlockHandler(RendererGlasBlock.instance);
        }
    }
 
Example 5
Source File: FluidLoader.java    From bartworks with MIT License 5 votes vote down vote up
public static Fluid createAndRegisterFluid(String Name, Color color, int temperature){
    Fluid f = new GT_Fluid(Name,"molten.autogenerated",new short[]{(short) color.getRed(),(short) color.getGreen(),(short) color.getBlue(), (short) color.getAlpha()});
    GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), Name);
    f.setTemperature(temperature);
    FluidRegistry.registerFluid(f);
    return f;
}
 
Example 6
Source File: BlockFluid.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
static Fluid createFluid(ContentBlockFluid content)
{
    Fluid fluid = new Fluid(content.id, content.texStill, content.texFlowing);
    fluid.setDensity(content.density);
    fluid.setTemperature(content.temperature);
    fluid.setGaseous(content.isGaseous);
    fluid.setViscosity(content.viscosity);
    fluid.setLuminosity(content.light.get(0).orElse(0));

    FluidRegistry.registerFluid(fluid);
    return fluid;
}
 
Example 7
Source File: Fluids.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static Fluid newFluid(String modID, String name, int density, int viscosity, int temperature, int luminosity, int tintColor) {
	Fluid f = new CustomFluid(name,new ResourceLocation(modID+":blocks/"+name+"_still"),new ResourceLocation(modID+":blocks/"+name+"_flow"),tintColor);
	f.setDensity(density);
	f.setViscosity(viscosity);
	f.setTemperature(temperature);
	f.setLuminosity(luminosity);
	f.setUnlocalizedName(modID+"."+name);
	FluidRegistry.registerFluid(f);
	return f;
}
 
Example 8
Source File: CommonProxy.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void preInit(FMLPreInitializationEvent event)
{
	TFC_Sounds.register();
	registerWorldGen();

	DimensionManager.unregisterDimension(0);
	DimensionManager.registerDimension(0, DimensionTFC.SURFACE);
	DimensionManager.registerDimension(2, DimensionTFC.PATHS);

	ResourceLocation still = Core.CreateRes(Reference.getResID()+"blocks/water_still");
	ResourceLocation flow = Core.CreateRes(Reference.getResID()+"blocks/water_flow");
	TFCFluids.SALTWATER = new FluidTFC("saltwater", still, flow).setBaseColor(0xff001945);
	TFCFluids.FRESHWATER = new FluidTFC("freshwater", still, flow).setBaseColor(0xff001945);
	FluidRegistry.registerFluid(TFCFluids.SALTWATER);
	FluidRegistry.registerFluid(TFCFluids.FRESHWATER);
	registerCrops();
	TFCBlocks.LoadBlocks();
	TFCBlocks.RegisterBlocks();
	TFCBlocks.RegisterTileEntites();
	TFCItems.Load();
	TFCItems.SetupCreativeTabs();
	TFCItems.Register();
	registerCropProduce();//Must run after item setup
	setupOre();
	registerOreDictionary();

	SkillsManager.instance.registerSkill(new Skill("gui.skill.woodworker", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.smith", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.toolsmith", 1.0f, 10f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.weaponsmith", 1.0f, 10f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.armorsmith", 1.0f, 10f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.farmer", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.fisherman", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.butcher", 1.0f, 1f));

	readSizeWeight();
}
 
Example 9
Source File: RegistrationHandler.java    From EmergingTechnology with MIT License 4 votes vote down vote up
public static void registerFluid(Fluid fluid) {
    FluidRegistry.registerFluid(fluid);
    FluidRegistry.addBucketForFluid(fluid);
}
 
Example 10
Source File: FluidLoader.java    From bartworks with MIT License 4 votes vote down vote up
public static Fluid createAndRegisterFluid(String Name,Color color){
    Fluid f = new GT_Fluid(Name,"molten.autogenerated",new short[]{(short) color.getRed(),(short) color.getGreen(),(short) color.getBlue(), (short) color.getAlpha()});
    GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), Name);
    FluidRegistry.registerFluid(f);
    return f;
}
 
Example 11
Source File: ModLiquids.java    From YouTubeModdingTutorial with MIT License 4 votes vote down vote up
public static void init() {
    FluidRegistry.registerFluid(fload);
    FluidRegistry.addBucketForFluid(fload);
}
 
Example 12
Source File: FluidWitchWater.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
public FluidWitchWater() {
	super("witchwater", new ResourceLocation("exnihiloadscensio:blocks/fluidWitchWaterStill"), new ResourceLocation("exnihiloadscensio:blocks/fluidWitchWaterFlow"));
	
	FluidRegistry.registerFluid(this);
}
 
Example 13
Source File: FluidPneumaticCraft.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public FluidPneumaticCraft(String fluidName, boolean registerBlock){
    super(fluidName);
    FluidRegistry.registerFluid(this);
    if(registerBlock) setBlock(new BlockFluidPneumaticCraft(this));
}
 
Example 14
Source File: GTMaterialGen.java    From GT-Classic with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * For creating a fluid from a material directly.
 * 
 * @param mat  - GTMaterial to use
 * @param flag - GTMaterialFlag to combine with the material
 */
public static void materialFluidUtil(GTMaterial mat, GTMaterialFlag flag) {
	if (mat.hasFlag(flag)) {
		FluidRegistry.registerFluid(new GTFluid(mat, flag));
	}
}