Merge branch 'BuildCraft-5.0.x' into BuildCraft-5.1.x

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

View file

@ -9,6 +9,9 @@
package buildcraft; package buildcraft;
import java.util.TreeMap; 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.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,6 +21,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
@ -34,6 +38,7 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCTrigger; import buildcraft.core.triggers.BCTrigger;
import buildcraft.core.utils.BCLog;
import buildcraft.energy.BlockBuildcraftFluid; import buildcraft.energy.BlockBuildcraftFluid;
import buildcraft.energy.BlockEngine; import buildcraft.energy.BlockEngine;
import buildcraft.energy.BucketHandler; import buildcraft.energy.BucketHandler;
@ -81,6 +86,9 @@ public class BuildCraftEnergy extends BuildCraftMod {
public static Item fuel; public static Item fuel;
public static boolean canOilBurn; public static boolean canOilBurn;
public static double oilWellScalar = 1.0; 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 TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(EnergyStage.BLUE); public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(EnergyStage.BLUE);
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(EnergyStage.GREEN); public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(EnergyStage.GREEN);
@ -95,6 +103,54 @@ public class BuildCraftEnergy extends BuildCraftMod {
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN); 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); 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); 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 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); 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); BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
// Do not generate oil in the End or Nether // Do not generate oil in the End or Nether
if (excludedBiomes.contains(biome.biomeID)) { if (BuildCraftEnergy.excludeOilBiomeIDs.contains(biome.biomeID)) {
return; return;
} }
boolean oilBiome = surfaceDepositBiomes.contains(biome.biomeID) boolean oilBiome = BuildCraftEnergy.oilBiomeIDs.contains(biome.biomeID);
|| BiomeDictionary.isBiomeOfType(biome, DESERT)
|| (BiomeDictionary.isBiomeOfType(biome, WASTELAND) && !BiomeDictionary.isBiomeOfType(biome, FROZEN))
|| (BiomeDictionary.isBiomeOfType(biome, FOREST) && BiomeDictionary.isBiomeOfType(biome, FROZEN));
double bonus = oilBiome ? 3.0 : 1.0; double bonus = oilBiome ? 3.0 : 1.0;
bonus *= BuildCraftEnergy.oilWellScalar; bonus *= BuildCraftEnergy.oilWellScalar;
if (excessiveBiomes.contains(biome.biomeID)) { if (BuildCraftEnergy.excessiveOilBiomeIDs.contains(biome.biomeID)) {
bonus *= 30.0; bonus *= 30.0;
} else if (BuildCraftCore.debugMode) { } else if (BuildCraftCore.debugMode) {
bonus *= 20.0; bonus *= 20.0;