From 8a85d97ae88b1590bdad1fb1f624f4af848f86ea Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Fri, 20 Sep 2013 09:34:13 -0400 Subject: [PATCH] BlockRegistryChanges --- .../core/registration/ModObjectRegistry.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/dark/core/registration/ModObjectRegistry.java b/src/dark/core/registration/ModObjectRegistry.java index eda4541d2..ff13b8e77 100644 --- a/src/dark/core/registration/ModObjectRegistry.java +++ b/src/dark/core/registration/ModObjectRegistry.java @@ -15,6 +15,8 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemBlock; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.Configuration; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import dark.core.common.DarkMain; @@ -204,6 +206,33 @@ public class ModObjectRegistry } + public static Block createNewFluidBlock(String modDomainPrefix, Configuration config, Fluid fluid) + { + Block fluidBlock = null; + Fluid fluidActual = null; + if (config != null && fluid != null && config.get("general", "EnableOilFluid", true).getBoolean(true) && FluidRegistry.getFluid(fluid.getName()) == null) + { + FluidRegistry.registerFluid(fluid); + fluidActual = FluidRegistry.getFluid(fluid.getName()); + if (fluidActual == null) + { + fluidActual = fluid; + } + + if (fluidActual.getBlockID() == -1 && masterBlockConfig.get("Enabled_List", "Enabled_" + fluid.getName() + "Block", true).getBoolean(true)) + { + fluidBlock = new BlockFluid(modDomainPrefix, fluidActual, config).setUnlocalizedName("tile.Fluid." + fluid.getName()); + GameRegistry.registerBlock(fluidBlock, "DMBlockFluid" + fluid.getName()); + } + else + { + fluidBlock = Block.blocksList[fluid.getBlockID()]; + } + } + + return fluidBlock; + } + public static void registerBlock(Block block, Class itemClass, String name, String modID) { if (block != null && name != null && !name.isEmpty())