Search in sources :

Example 1 with FluidDefinition

use of buildcraft.core.lib.fluids.FluidDefinition in project BuildCraft by BuildCraft.

the class BuildCraftEnergy method preInit.

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
    BuildcraftFuelRegistry.fuel = FuelManager.INSTANCE;
    BuildcraftFuelRegistry.coolant = CoolantManager.INSTANCE;
    int oilDesertBiomeId = BuildCraftCore.mainConfigManager.register("worldgen.biomes", "biomeOilDesert", DefaultProps.BIOME_OIL_DESERT, "The id for the Oil Desert biome", RestartRequirement.GAME).getInt();
    int oilOceanBiomeId = BuildCraftCore.mainConfigManager.register("worldgen.biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN, "The id for the Oil Ocean biome", RestartRequirement.GAME).getInt();
    BuildCraftCore.mainConfigManager.register("worldgen.spawnOilSprings", true, "Should I spawn oil springs?", RestartRequirement.GAME);
    BuildCraftCore.mainConfigManager.register("worldgen.oilWellGenerationRate", 1.0D, "How high should be the probability of an oil well generating?", RestartRequirement.NONE);
    setBiomeList(OilPopulateOld.INSTANCE.surfaceDepositBiomes, BuildCraftCore.mainConfigManager.register("worldgen.biomes", "increasedOilIDs", new String[] { BiomeDictionary.Type.SANDY.toString(), BiomeGenBase.taiga.biomeName }, "IDs or Biome Types (e.g. SANDY,OCEAN) of biomes that should have increased oil generation rates.", RestartRequirement.GAME));
    setBiomeList(OilPopulateOld.INSTANCE.excessiveBiomes, BuildCraftCore.mainConfigManager.register("worldgen.biomes", "excessiveOilIDs", new String[] {}, "IDs or Biome Types (e.g. SANDY,OCEAN) of biomes that should have GREATLY increased oil generation rates.", RestartRequirement.GAME));
    setBiomeList(OilPopulateOld.INSTANCE.excludedBiomes, BuildCraftCore.mainConfigManager.register("worldgen.biomes", "excludeOilIDs", new String[] { BiomeGenBase.sky.biomeName, BiomeGenBase.hell.biomeName }, "IDs or Biome Types (e.g. SANDY,OCEAN) of biomes that are excluded from generating oil.", RestartRequirement.GAME));
    BuildCraftCore.mainConfigManager.register("general", "fuel.oil.combustion", 1.0F, "adjust energy value of Oil in Combustion Engines", RestartRequirement.GAME);
    BuildCraftCore.mainConfigManager.register("general", "fuel.fuel.combustion", 1.0F, "adjust energy value of Fuel in Combustion Engines", RestartRequirement.GAME);
    BuildCraftCore.mainConfigManager.register("general", "fuel.oil.combustion.energyOutput", 30, "adjust output energy by Oil in Combustion Engines", RestartRequirement.GAME);
    BuildCraftCore.mainConfigManager.register("general", "fuel.fuel.combustion.energyOutput", 60, "adjust output energy by Fuel in Combustion Engines", RestartRequirement.GAME);
    BuildCraftCore.mainConfiguration.save();
    BiomeGenBase[] biomeGenArray = BiomeGenBase.getBiomeGenArray();
    if (oilDesertBiomeId > 0) {
        if (oilDesertBiomeId >= biomeGenArray.length || biomeGenArray[oilDesertBiomeId] != null) {
            oilDesertBiomeId = findUnusedBiomeID("oilDesert");
            // save changes to config file
            BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId);
            BuildCraftCore.mainConfiguration.save();
        }
        biomeOilDesert = BiomeGenOilDesertOld.makeBiome(oilDesertBiomeId);
    }
    if (oilOceanBiomeId > 0) {
        if (oilOceanBiomeId >= biomeGenArray.length || biomeGenArray[oilOceanBiomeId] != null) {
            oilOceanBiomeId = findUnusedBiomeID("oilOcean");
            // save changes to config file
            BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId);
            BuildCraftCore.mainConfiguration.save();
        }
        biomeOilOcean = BiomeGenOilOceanOld.makeBiome(oilOceanBiomeId);
    }
    // Only register oil and fuel if factory is NOT loaded, as then factory controls all refining stuffs.
    if (!Loader.isModLoaded("BuildCraft|Factory")) {
        oil = new FluidDefinition("oil", 800, 10000);
        oil.block.setLightOpacity(8);
        oil.fluid.setColour(0x50_50_50, 0x05_05_05);
        oil.block.setFlammability(0);
        BuildCraftCore.mainConfigManager.register("general.oilCanBurn", true, "Should oil burn when lit on fire?", RestartRequirement.NONE);
        BuildCraftCore.mainConfigManager.register("general.oilIsDense", false, "Should oil be dense and push enties up?", RestartRequirement.NONE);
        fuel = new FluidDefinition("fuel", 1000, 1000);
        fuel.block.setFlammable(true).setFlammability(5).setParticleColor(0.7F, 0.7F, 0.0F);
        fuel.fluid.setColour(0xFF_FF_30, 0xE4_CF_00);
        spawnOilSprings = BuildCraftCore.mainConfigManager.get("worldgen.spawnOilSprings").getBoolean(true);
        EnumSpring.OIL.canGen = spawnOilSprings;
        EnumSpring.OIL.liquidBlock = oil.block.getDefaultState();
    }
    if (BuildCraftCore.DEVELOPER_MODE) {
        redPlasma = new FluidDefinition("redplasma", 10000, 10000);
        redPlasma.fluid.setColour(0xDE_DE_DE, 0x50_00_00);
        redPlasma.fluid.setLuminosity(30);
        redPlasma.block.setFlammable(false).setParticleColor(0.9F, 0, 0);
    }
    BuildCraftCore.engineBlock.registerTile(TileEngineStone.class, 1, "tile.engineStone");
    BuildCraftCore.engineBlock.registerTile(TileEngineIron.class, 2, "tile.engineIron");
    BuildCraftCore.engineBlock.registerTile(TileEngineCreative.class, 3, "tile.engineCreative");
    InterModComms.registerHandler(new IMCHandlerEnergy());
    MinecraftForge.EVENT_BUS.register(this);
}
Also used : FluidDefinition(buildcraft.core.lib.fluids.FluidDefinition)

Example 2 with FluidDefinition

use of buildcraft.core.lib.fluids.FluidDefinition in project BuildCraft by BuildCraft.

the class ComplexRefiningManager method defineFluid.

private static FluidDefinition defineFluid(String name, int density, int baseViscocity, int heat, int boilPoint, int texColourLight, int texColourDark) {
    String fullName = name + (heat == 0 ? "" : "_heat_" + heat);
    int tempAdjustedViscocity = baseViscocity * (5 - heat) / 5;
    int boilAdjustedDensity = density * (heat >= boilPoint ? -1 : 1);
    FluidDefinition def = new FluidDefinition(fullName, fullName, boilAdjustedDensity, tempAdjustedViscocity, 0xFF_00_00_00 | texColourLight, 0xFF_00_00_00 | texColourDark);
    if (def.bucket != null && heat != 0) {
        def.bucket.setCreativeTab(null);
    }
    def.fluid.setHeat(heat);
    def.fluid.setUnlocalizedName(name);
    def.fluid.setTemperature(300 + 20 * heat);
    if (heat > 0)
        def.fluid.setHeatable(true);
    allFluids.add(def);
    return def;
}
Also used : FluidDefinition(buildcraft.core.lib.fluids.FluidDefinition)

Example 3 with FluidDefinition

use of buildcraft.core.lib.fluids.FluidDefinition in project BuildCraft by BuildCraft.

the class ComplexRefiningManager method registerModels.

@SideOnly(Side.CLIENT)
public static void registerModels(ModelBakeEvent event) {
    for (FluidDefinition def : allFluids) {
        IModel model = new ModelFluid(def.fluid);
        IBakedModel baked = model.bake(ModelRotation.X0_Y0, DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter());
        ModelResourceLocation loc = ModelHelper.getBlockResourceLocation(def.block);
        event.getModelRegistry().putObject(loc, baked);
    }
}
Also used : FluidDefinition(buildcraft.core.lib.fluids.FluidDefinition) IModel(net.minecraftforge.client.model.IModel) ModelFluid(net.minecraftforge.client.model.ModelFluid) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with FluidDefinition

use of buildcraft.core.lib.fluids.FluidDefinition in project BuildCraft by BuildCraft.

the class ComplexRefiningManager method textureStitchPre.

@SideOnly(Side.CLIENT)
public static void textureStitchPre(TextureStitchEvent.Pre event) {
    for (FluidDefinition def : allFluids) {
        int heat = def.fluid.getHeatValue();
        String from = "buildcraftenergy:blocks/fluids/heat_" + heat;
        SpriteColourMapper mapper = new SpriteColourMapper(def.fluid, from + "_still", true);
        event.getMap().setTextureEntry(mapper);
        mapper = new SpriteColourMapper(def.fluid, from + "_flow", false);
        event.getMap().setTextureEntry(mapper);
    }
}
Also used : FluidDefinition(buildcraft.core.lib.fluids.FluidDefinition) SpriteColourMapper(buildcraft.core.lib.client.sprite.SpriteColourMapper) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with FluidDefinition

use of buildcraft.core.lib.fluids.FluidDefinition in project BuildCraft by BuildCraft.

the class BuildCraftEnergy method textureStitchPre.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureStitchPre(TextureStitchEvent.Pre event) {
    FluidDefinition[] arr = { oil, fuel, redPlasma };
    if (Loader.isModLoaded("BuildCraft|Factory")) {
        arr[0] = null;
        arr[1] = null;
    }
    if (!BuildCraftCore.DEVELOPER_MODE) {
        arr[2] = null;
    }
    for (FluidDefinition def : arr) {
        if (def == null)
            continue;
        int heat = def.fluid.getHeatValue();
        String from = "buildcraftenergy:blocks/fluids/heat_" + heat;
        SpriteColourMapper mapper = new SpriteColourMapper(def.fluid, from + "_still", true);
        event.map.setTextureEntry(def.fluid.getStill().toString(), mapper);
        mapper = new SpriteColourMapper(def.fluid, from + "_flow", false);
        event.map.setTextureEntry(def.fluid.getFlowing().toString(), mapper);
    }
}
Also used : FluidDefinition(buildcraft.core.lib.fluids.FluidDefinition) SpriteColourMapper(buildcraft.core.lib.client.sprite.SpriteColourMapper) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

FluidDefinition (buildcraft.core.lib.fluids.FluidDefinition)7 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 SpriteColourMapper (buildcraft.core.lib.client.sprite.SpriteColourMapper)2 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 IModel (net.minecraftforge.client.model.IModel)2 ModelFluid (net.minecraftforge.client.model.ModelFluid)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 IComplexRefineryRecipeManager (buildcraft.api.recipes.IComplexRefineryRecipeManager)1