Merge branch 'BuildCraft-5.1.x' into NextGen

This commit is contained in:
SpaceToad 2014-04-28 20:05:39 +02:00
commit 3411d023a5
2 changed files with 59 additions and 6 deletions

View file

@ -9,6 +9,9 @@
package buildcraft;
import java.util.TreeMap;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -18,6 +21,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fluids.Fluid;
@ -36,6 +40,7 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCTrigger;
import buildcraft.core.utils.BCLog;
import buildcraft.energy.BlockBuildcraftFluid;
import buildcraft.energy.BlockEnergyEmitter;
import buildcraft.energy.BlockEnergyReceiver;
@ -91,6 +96,9 @@ public class BuildCraftEnergy extends BuildCraftMod {
public static Item fuel;
public static boolean canOilBurn;
public static double oilWellScalar = 1.0;
public static Set<Integer> oilBiomeIDs = new HashSet<Integer>();
public static Set<Integer> excessiveOilBiomeIDs = new HashSet<Integer>();
public static Set<Integer> excludeOilBiomeIDs = new HashSet<Integer>();
public static TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(EnergyStage.BLUE);
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(EnergyStage.GREEN);
@ -105,6 +113,54 @@ public class BuildCraftEnergy extends BuildCraftMod {
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
canOilBurn = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "burnOil", true, "Can oil burn?").getBoolean(true);
oilWellScalar = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "oilWellGenerationRate", 1.0, "Probability of oil well generation").getDouble(1.0);
for (String id : BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "oilBiomeIDs", BiomeDictionary.Type.DESERT.toString() +","+BiomeGenBase.taiga.biomeID, "IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that should have increased oil generation rates.").getString().trim().split(",")){
id = id.trim();
if(id.length() > 0){
try{oilBiomeIDs.add(Integer.parseInt(id));}
catch(NumberFormatException ex){ //not an int so try and parse it as a biome type
try{
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(id.toUpperCase()))){
oilBiomeIDs.add(b.biomeID);
}
}
catch (Exception e){
BCLog.logger.log(Level.WARNING,"config.oilBiomeIDs: Could not find biome type: " + id + " ; Skipping!");
}
}
}
}
for(String id : BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "excessiveOilBiomeIDs", "", "IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that should have GREATLY increased oil generation rates.").getString().trim().split(",")) {
id = id.trim();
if(id.length() > 0){
try{excessiveOilBiomeIDs.add(Integer.parseInt(id));}
catch(NumberFormatException ex){ //not an int so try and parse it as a biome type
try{
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(id.toUpperCase()))){
excessiveOilBiomeIDs.add(b.biomeID);
}
}
catch (Exception e){
BCLog.logger.log(Level.WARNING,"config.excessiveOilBiomeIDs: Could not find biome type: " + id + " ; Skipping!");
}
}
}
}
for(String id : BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "excludeOilBiomeIDs", BiomeGenBase.sky.biomeID +","+BiomeGenBase.hell.biomeID, "IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that are excluded from generating oil.").getString().trim().split(",")){
id = id.trim();
if(id.length() > 0){
try{excludeOilBiomeIDs.add(Integer.parseInt(id));}
catch(NumberFormatException ex){ //not an int so try and parse it as a biome type
try{
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(id.toUpperCase()))){
excludeOilBiomeIDs.add(b.biomeID);
}
}
catch (Exception e){
BCLog.logger.log(Level.WARNING,"config.excludeOilBiomeIDs: Could not find biome type: " + id + " ; Skipping!");
}
}
}
}
double fuelOilMultiplier = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.oil.combustion", 1.0F, "adjust energy value of Oil in Combustion Engines").getDouble(1.0F);
double fuelFuelMultiplier = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "fuel.fuel.combustion", 1.0F, "adjust energy value of Fuel in Combustion Engines").getDouble(1.0F);

View file

@ -83,18 +83,15 @@ public class OilPopulate {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
// Do not generate oil in the End or Nether
if (excludedBiomes.contains(biome.biomeID)) {
if (BuildCraftEnergy.excludeOilBiomeIDs.contains(biome.biomeID)) {
return;
}
boolean oilBiome = surfaceDepositBiomes.contains(biome.biomeID)
|| BiomeDictionary.isBiomeOfType(biome, DESERT)
|| (BiomeDictionary.isBiomeOfType(biome, WASTELAND) && !BiomeDictionary.isBiomeOfType(biome, FROZEN))
|| (BiomeDictionary.isBiomeOfType(biome, FOREST) && BiomeDictionary.isBiomeOfType(biome, FROZEN));
boolean oilBiome = BuildCraftEnergy.oilBiomeIDs.contains(biome.biomeID);
double bonus = oilBiome ? 3.0 : 1.0;
bonus *= BuildCraftEnergy.oilWellScalar;
if (excessiveBiomes.contains(biome.biomeID)) {
if (BuildCraftEnergy.excessiveOilBiomeIDs.contains(biome.biomeID)) {
bonus *= 30.0;
} else if (BuildCraftCore.debugMode) {
bonus *= 20.0;