fixed duplate method

This commit is contained in:
SpaceToad 2014-04-03 08:44:33 +02:00
parent 78cef2a3b8
commit 8a76edd91a

View file

@ -8,10 +8,25 @@
*/
package buildcraft;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
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.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.fuels.IronEngineCoolant;
import buildcraft.api.fuels.IronEngineFuel;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.core.recipes.RefineryRecipeManager;
import buildcraft.core.BlockIndex;
import buildcraft.core.BlockSpring;
import buildcraft.core.DefaultProps;
@ -21,12 +36,11 @@ import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCTrigger;
import buildcraft.energy.BlockBuildcraftFluid;
import buildcraft.energy.BlockEngine;
import buildcraft.energy.BptBlockEngine;
import buildcraft.energy.BucketHandler;
import buildcraft.energy.EnergyProxy;
import buildcraft.energy.GuiHandler;
import buildcraft.energy.ItemBucketBuildcraft;
import buildcraft.energy.ItemEngine;
import buildcraft.energy.BucketHandler;
import buildcraft.energy.TileEngine.EnergyStage;
import buildcraft.energy.triggers.TriggerEngineHeat;
import buildcraft.energy.worldgen.BiomeGenOilDesert;
@ -47,24 +61,6 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
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.config.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftEnergy extends BuildCraftMod {
@ -113,7 +109,6 @@ public class BuildCraftEnergy extends BuildCraftMod {
if (oilDesertBiomeId > 0) {
if (BiomeGenBase.getBiomeGenArray () [oilDesertBiomeId] != null) {
//throw new BiomeIdException("oilDesert", oilDesertBiomeId);
oilDesertBiomeId = findUnusedBiomeID("oilDesert");
// save changes to config file
BuildCraftCore.mainConfiguration.get("biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId);
@ -124,7 +119,6 @@ public class BuildCraftEnergy extends BuildCraftMod {
if (oilOceanBiomeId > 0) {
if (BiomeGenBase.getBiomeGenArray () [oilOceanBiomeId] != null) {
//throw new BiomeIdException("oilOcean", oilOceanBiomeId);
oilOceanBiomeId = findUnusedBiomeID("oilOcean");
// save changes to config file
BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId);
@ -258,26 +252,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
private int findUnusedBiomeID (String biomeName) {
int freeBiomeID = 0;
// code to find a free biome
for (int i=1; i<256; i++) {
if (BiomeGenBase.getBiomeGenArray()[i] == null) {
freeBiomeID = i;
return freeBiomeID;
}
}
// failed to find any free biome IDs
class BiomeIdLimitException extends RuntimeException {
public BiomeIdLimitException(String biome) {
super(String.format("You have a run out of free Biome Ids for %s", biome));
}
}
throw new BiomeIdLimitException(biomeName);
}
private int findUnusedBiomeID (String biomeName) {
int freeBiomeID = 0;
// code to find a free biome
for (int i=1; i<256; i++) {
for (int i = 1; i < 256; i++) {
if (BiomeGenBase.getBiomeGenArray()[i] == null) {
freeBiomeID = i;
return freeBiomeID;