Remove BiomeTypes in favour of the more descriptive and configurable Climates

This commit is contained in:
Cheeserolls 2015-06-24 01:58:13 +01:00
parent 2a83422a36
commit dadae8758e
42 changed files with 312 additions and 241 deletions

View file

@ -26,10 +26,10 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.generation.GenerationManager;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.IGenerator;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.util.config.BOPConfig.IConfigObj;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.TerrainSettings;
@ -37,7 +37,7 @@ import biomesoplenty.common.world.TerrainSettings;
public class BOPBiome extends BiomeGenBase implements IExtendedBiome
{
private GenerationManager generationManager = new GenerationManager();
private Map<BiomeType, Integer> weightMap = new HashMap<BiomeType, Integer>();
private Map<BOPClimates, Integer> weightMap = new HashMap<BOPClimates, Integer>();
// defaults
public int skyColor = -1; // -1 indicates the default skyColor by temperature will be used
@ -94,17 +94,17 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
IConfigObj confWeights = conf.getObject("weights");
if (confWeights != null)
{
for (BiomeType type : BiomeType.values())
for (BOPClimates climate : BOPClimates.values())
{
Integer weight = confWeights.getInt(type.name().toLowerCase(), null);
Integer weight = confWeights.getInt(climate.name().toLowerCase(), null);
if (weight == null) {continue;}
if (weight.intValue() < 1)
{
this.weightMap.remove(type);
this.weightMap.remove(climate);
}
else
{
this.weightMap.put(type, weight);
this.weightMap.put(climate, weight);
}
}
}
@ -219,15 +219,15 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
}
@Override
public Map<BiomeType, Integer> getWeightMap()
public Map<BOPClimates, Integer> getWeightMap()
{
return this.weightMap;
}
@Override
public void addWeight(BiomeType type, int weight)
public void addWeight(BOPClimates climate, int weight)
{
this.weightMap.put(type, weight);
this.weightMap.put(climate, weight);
}
@Override

View file

@ -23,12 +23,14 @@ public class BOPBiomes
public static Optional<BiomeGenBase> boreal_forest = Optional.absent();
public static Optional<BiomeGenBase> brushland = Optional.absent();
public static Optional<BiomeGenBase> canyon = Optional.absent();
public static Optional<BiomeGenBase> crag = Optional.absent();
public static Optional<BiomeGenBase> chaparral = Optional.absent();
public static Optional<BiomeGenBase> cherry_blossom_grove = Optional.absent();
public static Optional<BiomeGenBase> coldDesert = Optional.absent();
public static Optional<BiomeGenBase> coniferous_forest = Optional.absent();
public static Optional<BiomeGenBase> crag = Optional.absent();
public static Optional<BiomeGenBase> denseForest = Optional.absent();
public static Optional<BiomeGenBase> flowerField = Optional.absent();
public static Optional<BiomeGenBase> frozenDesert = Optional.absent();
public static Optional<BiomeGenBase> grassland = Optional.absent();
public static Optional<BiomeGenBase> heathland = Optional.absent();
public static Optional<BiomeGenBase> highland = Optional.absent();

View file

@ -10,17 +10,17 @@ package biomesoplenty.api.biome;
import java.util.Map;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.generation.GenerationManager;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.IGenerator;
import biomesoplenty.common.enums.BOPClimates;
public interface IExtendedBiome
{
public BiomeOwner getBiomeOwner();
public void addGenerator(String name, GeneratorStage stage, IGenerator generator);
public GenerationManager getGenerationManager();
public Map<BiomeType, Integer> getWeightMap();
public Map<BOPClimates, Integer> getWeightMap();
public void clearWeights();
public void addWeight(BiomeType type, int weight);
public void addWeight(BOPClimates climate, int weight);
}

View file

@ -1,45 +0,0 @@
/*******************************************************************************
* Copyright 2015, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.biome;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import net.minecraftforge.common.BiomeManager.BiomeType;
public class BOPBiomeManager
{
private static ArrayList<BiomeEntry>[] biomes = new ArrayList[4];
static
{
for (int i = 0; i < biomes.length; i++)
{
biomes[i] = new ArrayList();
}
}
public static void addBiome(BiomeType type, BiomeEntry entry)
{
int idx = type.ordinal();
List<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
if (list != null) list.add(entry);
}
public static ImmutableList<BiomeEntry> getBiomes(BiomeType type)
{
int idx = type.ordinal();
List<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
return list == null ? ImmutableList.<BiomeEntry>of() : ImmutableList.copyOf(list);
}
}

View file

@ -12,12 +12,12 @@ import java.util.HashMap;
import java.util.Map;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BiomeOwner;
import biomesoplenty.api.biome.IExtendedBiome;
import biomesoplenty.api.biome.generation.GenerationManager;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.IGenerator;
import biomesoplenty.common.enums.BOPClimates;
public class ExtendedBiomeRegistry
{
@ -51,7 +51,7 @@ public class ExtendedBiomeRegistry
{
public final BiomeGenBase biome;
private GenerationManager generationManager = new GenerationManager();
private Map<BiomeType, Integer> weightMap = new HashMap<BiomeType, Integer>();
private Map<BOPClimates, Integer> weightMap = new HashMap<BOPClimates, Integer>();
private BiomeExtension(BiomeGenBase biome)
{
@ -77,15 +77,15 @@ public class ExtendedBiomeRegistry
}
@Override
public Map<BiomeType, Integer> getWeightMap()
public Map<BOPClimates, Integer> getWeightMap()
{
return this.weightMap;
}
@Override
public void addWeight(BiomeType type, int weight)
public void addWeight(BOPClimates climate, int weight)
{
this.weightMap.put(type, weight);
this.weightMap.put(climate, weight);
}
@Override

View file

@ -9,9 +9,9 @@
package biomesoplenty.common.biome.overworld;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
@ -29,7 +29,8 @@ public class BiomeGenAlps extends BOPBiome
this.setEnableSnow();
this.setTemperatureRainfall(0.0F, 0.5F);
this.addWeight(BiomeType.ICY, 5);
this.addWeight(BOPClimates.BOREAL, 5);
this.addWeight(BOPClimates.COLD_DESERT, 5);
this.topBlock = Blocks.snow.getDefaultState();
this.fillerBlock = Blocks.snow.getDefaultState();

View file

@ -9,9 +9,9 @@
package biomesoplenty.common.biome.overworld;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
@ -27,7 +27,7 @@ public class BiomeGenArctic extends BOPBiome
this.setEnableSnow();
this.setTemperatureRainfall(0.05F, 0.5F);
this.addWeight(BiomeType.ICY, 10);
this.addWeight(BOPClimates.ICE_CAP, 30);
this.spawnableCreatureList.clear();

View file

@ -18,7 +18,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -26,6 +25,7 @@ import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.common.block.BlockBOPPlant;
import biomesoplenty.common.block.BlockBOPCoral;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
@ -57,7 +57,7 @@ public class BiomeGenBambooForest extends BOPBiome
this.setTemperatureRainfall(1.2F, 0.9F);
this.waterColorMultiplier = 0x00ff66;
this.addWeight(BiomeType.DESERT, 5);
this.addWeight(BOPClimates.TROPICAL, 5);
this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL);
this.usualTopBlock = this.topBlock;

View file

@ -13,7 +13,6 @@ import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -22,6 +21,7 @@ import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.common.block.BlockBOPCoral;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
@ -54,7 +54,7 @@ public class BiomeGenBayou extends BOPBiome
this.skyColor = 0xACC4BC;
this.seaFloorBlock = BOPBlocks.mud.getDefaultState();
this.addWeight(BiomeType.WARM, 10);
this.addWeight(BOPClimates.HOT_SWAMP, 10);
this.spawnableWaterCreatureList.clear();
this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3));

View file

@ -15,7 +15,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -27,6 +26,7 @@ import biomesoplenty.common.block.BlockBOPGrass;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.block.BlockBOPMushroom;
import biomesoplenty.common.block.BlockBOPPlant;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
@ -52,7 +52,7 @@ public class BiomeGenBog extends BOPBiome
this.topBlock = BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.LOAMY);
this.fillerBlock = BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT, BlockBOPDirt.BOPDirtType.LOAMY);
this.addWeight(BiomeType.COOL, 7);
this.addWeight(BOPClimates.COLD_SWAMP, 7);
this.spawnableCreatureList.clear();
this.spawnableWaterCreatureList.clear();

View file

@ -6,12 +6,12 @@ import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
@ -27,6 +27,7 @@ import biomesoplenty.common.world.feature.tree.GeneratorTaigaTree;
public class BiomeGenBorealForest extends BOPBiome
{
// TODO: this is very poorly named, boreal forests are cold, this is a mixed forest
public BiomeGenBorealForest()
{
// terrain
@ -34,7 +35,7 @@ public class BiomeGenBorealForest extends BOPBiome
this.setColor(0x9FB771);
this.setTemperatureRainfall(0.5F, 0.6F);
this.addWeight(BiomeType.COOL, 10);
this.addWeight(BOPClimates.COOL_TEMPERATE, 10);
this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4));

View file

@ -5,12 +5,12 @@ import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.block.BlockBOPSand;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
@ -32,7 +32,7 @@ public class BiomeGenBrushland extends BOPBiome
this.setColor(0xC9C17F);
this.setTemperatureRainfall(1.2F, 0.1F);
this.addWeight(BiomeType.DESERT, 10);
this.addWeight(BOPClimates.MEDITERANEAN, 10);
// quicksand
this.addGenerator("quicksand_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(0.6F).splotchSize(16).with(BOPBlocks.sand.getDefaultState().withProperty(BlockBOPSand.VARIANT, BlockBOPSand.SandType.QUICKSAND)).splotchSize(20).scatterYMethod(ScatterYMethod.AT_SURFACE).create());

View file

@ -4,11 +4,11 @@ import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
@ -35,7 +35,7 @@ public class BiomeGenCanyon extends BOPBiome
{
this.terrainSettings.avgHeight(140).heightVariation(10, 10);
this.addWeight(BiomeType.DESERT, 5);
this.addWeight(BOPClimates.MEDITERANEAN, 5);
}
else
{

View file

@ -13,10 +13,10 @@ import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
@ -39,7 +39,7 @@ public class BiomeGenChaparral extends BOPBiome
this.setColor(0xC0D85D);
this.setTemperatureRainfall(0.8F, 0.6F);
this.addWeight(BiomeType.WARM, 10);
this.addWeight(BOPClimates.WARM_TEMPERATE, 10);
this.spawnableCreatureList.clear(); // none of your regular farmyard critters here
this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 1, 2, 6));

View file

@ -12,12 +12,12 @@ import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
@ -43,7 +43,7 @@ public class BiomeGenCherryBlossomGrove extends BOPBiome
this.setColor(0xF88F8F);
this.setTemperatureRainfall(0.6F, 0.8F);
this.addWeight(BiomeType.COOL, 3);
this.addWeight(BOPClimates.COOL_TEMPERATE, 3);
// boulders
this.addGenerator("boulders", GeneratorStage.SAND, (new GeneratorBlobs.Builder()).amountPerChunk(0.5F).placeOn(Blocks.grass).with(Blocks.stone.getDefaultState()).minRadius(0.3F).maxRadius(1.2F).numBalls(1).scatterYMethod(ScatterYMethod.AT_SURFACE).create());

View file

@ -0,0 +1,79 @@
/*******************************************************************************
* Copyright 2015, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.biome.overworld;
import net.minecraft.init.Blocks;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
import biomesoplenty.common.util.block.BlockQuery.BlockQueryBlock;
import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorBlobs;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
import biomesoplenty.common.world.feature.GeneratorSplotches;
public class BiomeGenColdDesert extends BOPBiome
{
public static enum ColdDesertType {FROZEN, COLD;}
public BiomeGenColdDesert(ColdDesertType type)
{
// terrain
this.terrainSettings.avgHeight(70).heightVariation(10, 25).sidewaysNoise(0.7D);
this.topBlock = Blocks.gravel.getDefaultState();
this.fillerBlock = Blocks.stone.getDefaultState();
this.enableRain = false;
this.enableSnow = false;
if (type == ColdDesertType.FROZEN)
{
this.setTemperatureRainfall(0.0F, 0.0F);
this.addWeight(BOPClimates.FROZEN_DESERT, 20);
this.setColor(0xB3D7E3);
}
else
{
this.setTemperatureRainfall(0.2F, 0.0F);
this.addWeight(BOPClimates.COLD_DESERT, 20);
this.setColor(0xB3AF9B);
}
this.spawnableCreatureList.clear();
// gravel, stone and boulders
IBlockPosQuery surface = new BlockQueryBlock(Blocks.stone, Blocks.gravel, BOPBlocks.hard_ice);
if (type == ColdDesertType.FROZEN)
{
this.addGenerator("hard_ice_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(6).splotchSize(24).placeOn(surface).replace(surface).with(BOPBlocks.hard_ice.getDefaultState()).scatterYMethod(ScatterYMethod.AT_SURFACE).create());
this.addGenerator("stone_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(3).splotchSize(16).placeOn(surface).replace(surface).with(Blocks.stone.getDefaultState()).scatterYMethod(ScatterYMethod.AT_SURFACE).create());
}
else
{
this.addGenerator("stone_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(6).splotchSize(24).placeOn(surface).replace(surface).with(Blocks.stone.getDefaultState()).scatterYMethod(ScatterYMethod.AT_SURFACE).create());
}
this.addGenerator("boulders", GeneratorStage.SAND_PASS2, (new GeneratorBlobs.Builder()).amountPerChunk(0.5F).placeOn(surface).with(Blocks.stone.getDefaultState()).minRadius(0.3F).maxRadius(3.2F).numBalls(4).scatterYMethod(ScatterYMethod.AT_SURFACE).create());
// gem
this.addGenerator("tanzanite", GeneratorStage.SAND, (new GeneratorOreSingle.Builder()).amountPerChunk(12).with(BOPGems.TANZANITE).create());
}
@Override
public void applySettings(BOPWorldSettings settings)
{
if (!settings.generateBopGems) {this.removeGenerator("tanzanite");}
}
}

View file

@ -3,7 +3,6 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -13,6 +12,7 @@ import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPGrass;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.block.BlockBOPMushroom;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
@ -38,7 +38,7 @@ public class BiomeGenConiferousForest extends BOPBiome
this.setColor(0x528F60);
this.setTemperatureRainfall(0.5F, 0.5F);
this.addWeight(BiomeType.COOL, 10);
this.addWeight(BOPClimates.COOL_TEMPERATE, 10);
this.topBlock = BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.LOAMY);
this.fillerBlock = BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT, BlockBOPDirt.BOPDirtType.LOAMY);

View file

@ -9,10 +9,10 @@
package biomesoplenty.common.biome.overworld;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
@ -26,7 +26,7 @@ public class BiomeGenCrag extends BOPBiome
this.setColor(5209457);
this.setTemperatureRainfall(1.0F, 0.0F);
this.addWeight(BiomeType.COOL, 3);
this.addWeight(BOPClimates.WET_TEMPERATE, 3);
this.spawnableCreatureList.clear();
this.spawnableWaterCreatureList.clear();

View file

@ -13,6 +13,7 @@ import java.util.Random;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.config.BOPConfig.IConfigObj;
@ -29,7 +30,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraftforge.common.BiomeManager.BiomeType;
public class BiomeGenDenseForest extends BOPBiome
{
@ -45,7 +45,7 @@ public class BiomeGenDenseForest extends BOPBiome
this.setColor(8246897);
this.setTemperatureRainfall(0.7F, 0.7F);
this.addWeight(BiomeType.WARM, 7);
this.addWeight(BOPClimates.WARM_TEMPERATE, 7);
this.topBlock = Blocks.grass.getDefaultState();
this.fillerBlock = Blocks.dirt.getDefaultState();

View file

@ -11,10 +11,10 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockFlower.EnumFlowerType;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.world.BOPWorldSettings;
@ -33,7 +33,7 @@ public class BiomeGenFlowerField extends BOPBiome
this.setColor(4044093);
this.setTemperatureRainfall(0.6F, 0.7F);
this.addWeight(BiomeType.WARM, 3);
this.addWeight(BOPClimates.COOL_TEMPERATE, 3);
// flowers
GeneratorWeighted flowerGenerator = new GeneratorWeighted(99);

View file

@ -12,7 +12,6 @@ import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.BlockFlower.EnumFlowerType;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -20,6 +19,7 @@ import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPMushroom;
import biomesoplenty.common.block.BlockBOPPlant;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.world.BOPWorldSettings;
@ -40,8 +40,9 @@ public class BiomeGenGrassland extends BOPBiome {
this.setColor(0x7FDB7D);
this.setTemperatureRainfall(0.6F, 0.7F);
this.addWeight(BiomeType.COOL, 10);
this.addWeight(BOPClimates.COOL_TEMPERATE, 7);
this.addWeight(BOPClimates.DRY_TEMPERATE, 7);
this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6));

View file

@ -14,10 +14,10 @@ import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
@ -43,7 +43,7 @@ public class BiomeGenHeathland extends BOPBiome
this.setColor(0xCEC577);
this.setTemperatureRainfall(0.8F, 0.2F);
this.addWeight(BiomeType.WARM, 10);
this.addWeight(BOPClimates.WARM_TEMPERATE, 10);
this.spawnableCreatureList.clear(); // none of your regular farmyard critters here
// TODO: why is there SO many horses?

View file

@ -11,10 +11,10 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
import biomesoplenty.common.world.BOPWorldSettings;
@ -35,7 +35,7 @@ public class BiomeGenHighland extends BOPBiome
this.setColor(0x7CAD66);
this.setTemperatureRainfall(0.5F, 0.8F);
this.addWeight(BiomeType.WARM, 7);
this.addWeight(BOPClimates.COOL_TEMPERATE, 7);
// other plants
this.addGenerator("wild_carrots", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).with(BOPPlants.WILDCARROT).create());

View file

@ -12,12 +12,12 @@ import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.block.BlockBOPStone;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
@ -40,7 +40,7 @@ public class BiomeGenJadeCliffs extends BOPBiome
this.skyColor = 0xB7CCAD;
this.setTemperatureRainfall(0.8F, 0.9F);
this.addWeight(BiomeType.WARM, 3);
this.addWeight(BOPClimates.WET_TEMPERATE, 3);
this.addGenerator("limestone_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(26).splotchSize(25).replace(Blocks.stone).with(BOPBlocks.stone.getDefaultState().withProperty(BlockBOPStone.VARIANT, BlockBOPStone.StoneType.LIMESTONE)).create());

View file

@ -10,10 +10,10 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
@ -36,7 +36,7 @@ public class BiomeGenLavenderFields extends BOPBiome
this.setColor(11035852);
this.setTemperatureRainfall(0.6F, 0.7F);
this.addWeight(BiomeType.WARM, 3);
this.addWeight(BOPClimates.WARM_TEMPERATE, 3);
// flowers
this.addGenerator("lavender", GeneratorStage.FLOWERS, (new GeneratorFlora.Builder()).amountPerChunk(99).with(BOPFlowers.LAVENDER).create());

View file

@ -12,7 +12,6 @@ import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -21,6 +20,7 @@ import biomesoplenty.common.block.BlockBOPDirt;
import biomesoplenty.common.block.BlockBOPGrass;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.block.BlockBOPCoral;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
@ -49,7 +49,7 @@ public class BiomeGenMarsh extends BOPBiome
this.setColor(0x66A06E);
this.setTemperatureRainfall(0.5F, 0.9F);
this.addWeight(BiomeType.WARM, 7);
this.addWeight(BOPClimates.COLD_SWAMP, 7);
this.spawnableCreatureList.clear(); // none of your regular farmyard critters here
this.spawnableWaterCreatureList.clear();

View file

@ -11,7 +11,6 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -20,6 +19,7 @@ import biomesoplenty.common.block.BlockBOPDirt;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPGrass;
import biomesoplenty.common.block.BlockBOPCoral;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
@ -43,7 +43,7 @@ public class BiomeGenMoor extends BOPBiome
this.topBlock = BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.LOAMY);
this.fillerBlock = BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT, BlockBOPDirt.BOPDirtType.LOAMY);
this.addWeight(BiomeType.COOL, 7);
this.addWeight(BOPClimates.COLD_SWAMP, 7);
this.spawnableCreatureList.clear();
this.spawnableWaterCreatureList.clear();

View file

@ -20,12 +20,12 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPWoods;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
@ -78,7 +78,7 @@ public class BiomeGenMountain extends BOPBiome
if (type == MountainType.PEAKS)
{
// peaks are created in the biome gen layer, foothills don't have a weight - they only appear later around the peaks (in the biome edge layer)
this.addWeight(BiomeType.COOL, 10);
this.addWeight(BOPClimates.DRY_TEMPERATE, 10);
// only sheep and wolves on the peaks
this.spawnableCreatureList.clear();

View file

@ -10,13 +10,13 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockFlower.EnumFlowerType;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.block.BlockBOPGrass;
import biomesoplenty.common.block.BlockBOPGrass.BOPGrassType;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.world.feature.GeneratorFlora;
@ -33,7 +33,7 @@ public class BiomeGenOriginValley extends BOPBiome
this.setTemperatureRainfall(0.7F, 0.8F);
this.skyColor = 8441086;
this.addWeight(BiomeType.WARM, 1);
this.addWeight(BOPClimates.WARM_TEMPERATE, 1);
this.topBlock = BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BOPGrassType.ORIGIN);

View file

@ -11,11 +11,11 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockSand;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.block.BlockQuery;
@ -36,7 +36,7 @@ public class BiomeGenOutback extends BOPBiome
this.topBlock = BOPBlocks.hard_sand.getDefaultState();
this.fillerBlock = BOPBlocks.hard_sand.getDefaultState();
this.addWeight(BiomeType.DESERT, 7);
this.addWeight(BOPClimates.HOT_DESERT, 7);
this.spawnableCreatureList.clear();
this.spawnableWaterCreatureList.clear();

View file

@ -12,11 +12,11 @@ import net.minecraft.block.BlockFlower.EnumFlowerType;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.world.BOPWorldSettings;
@ -38,7 +38,7 @@ public class BiomeGenShrubland extends BOPBiome
this.setColor(8168286);
this.setTemperatureRainfall(0.6F, 0.05F);
this.addWeight(BiomeType.COOL, 10);
this.addWeight(BOPClimates.DRY_TEMPERATE, 10);
this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6));

View file

@ -11,10 +11,10 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.common.block.BlockBOPPlant;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.world.BOPWorldSettings;
@ -32,7 +32,7 @@ public class BiomeGenSteppe extends BOPBiome
this.setColor(13413215);
this.setTemperatureRainfall(0.7F, 0.05F);
this.addWeight(BiomeType.DESERT, 5);
this.addWeight(BOPClimates.SAVANNA, 7);
this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6));

View file

@ -11,10 +11,10 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockFlower.EnumFlowerType;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.world.BOPWorldSettings;
@ -34,7 +34,7 @@ public class BiomeGenThicket extends BOPBiome
this.setColor(7248193);
this.setTemperatureRainfall(0.6F, 0.2F);
this.addWeight(BiomeType.COOL, 5);
this.addWeight(BOPClimates.DRY_TEMPERATE, 5);
// trees
GeneratorWeighted treeGenerator = new GeneratorWeighted(17);

View file

@ -11,10 +11,10 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
@ -38,7 +38,7 @@ public class BiomeGenTundra extends BOPBiome
this.setColor(0xA09456);
this.setTemperatureRainfall(0.165F, 0.5F); // temperature deliberately borderline between rain and snow
this.addWeight(BiomeType.ICY, 7);
this.addWeight(BOPClimates.TUNDRA, 10);
this.spawnableCreatureList.clear();

View file

@ -11,13 +11,13 @@ package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.block.BlockBOPMushroom;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPWoods;
@ -43,7 +43,7 @@ public class BiomeGenWoodland extends BOPBiome
this.setColor(0x84A92D);
this.setTemperatureRainfall(0.6F, 0.4F);
this.addWeight(BiomeType.COOL, 10);
this.addWeight(BOPClimates.COOL_TEMPERATE, 10);
// trees
GeneratorWeighted treeGenerator = new GeneratorWeighted(9);

View file

@ -1,5 +1,11 @@
package biomesoplenty.common.enums;
import java.util.ArrayList;
import java.util.Iterator;
import biomesoplenty.common.world.layer.GenLayerBiomeBOP;
import net.minecraft.world.biome.BiomeGenBase;
public enum BOPClimates {
ICE_CAP,
@ -17,9 +23,130 @@ public enum BOPClimates {
MEDITERANEAN,
SAVANNA,
HOT_DESERT;
private int totalLandBiomesWeight;
private ArrayList<WeightedBiomeEntry> landBiomes = new ArrayList<WeightedBiomeEntry>();
public BOPClimates addLandBiome(int weight, BiomeGenBase biome)
{
return this.addLandBiome(new WeightedBiomeEntry(weight, biome));
}
public BOPClimates addLandBiome(WeightedBiomeEntry biomeEntry)
{
this.totalLandBiomesWeight += biomeEntry.weight;
this.landBiomes.add(biomeEntry);
return this;
}
public BiomeGenBase getRandomLandBiome(GenLayerBiomeBOP layer)
{
int weight = layer.nextInt(this.totalLandBiomesWeight);
Iterator<WeightedBiomeEntry> iterator = this.landBiomes.iterator();
WeightedBiomeEntry item;
do
{
item = iterator.next();
weight -= item.weight;
}
while (weight >= 0);
return item.biome;
}
public BiomeGenBase getRandomOceanBiome(GenLayerBiomeBOP layer)
{
switch (this)
{
case ICE_CAP:
return (layer.nextInt(2)==0) ? this.getRandomLandBiome(layer) : BiomeGenBase.frozenOcean;
case FROZEN_DESERT: case TUNDRA: case COLD_DESERT: case BOREAL:
return (layer.nextInt(2)==0) ? BiomeGenBase.ocean : BiomeGenBase.frozenOcean;
default:
return BiomeGenBase.ocean;
}
}
static
{
// set up vanilla biomes
BOPClimates.ICE_CAP.addLandBiome(5,BiomeGenBase.icePlains);
BOPClimates.FROZEN_DESERT.addLandBiome(5, BiomeGenBase.icePlains);
BOPClimates.TUNDRA.addLandBiome(5, BiomeGenBase.icePlains).addLandBiome(5, BiomeGenBase.coldTaiga);
BOPClimates.COLD_DESERT.addLandBiome(10, BiomeGenBase.extremeHills);
BOPClimates.BOREAL.addLandBiome(30, BiomeGenBase.coldTaiga);
BOPClimates.COLD_SWAMP.addLandBiome(1, BiomeGenBase.swampland);
BOPClimates.WET_TEMPERATE.addLandBiome(10, BiomeGenBase.forest).addLandBiome(10, BiomeGenBase.birchForest);
BOPClimates.DRY_TEMPERATE.addLandBiome(10, BiomeGenBase.extremeHills).addLandBiome(10, BiomeGenBase.plains);
BOPClimates.COOL_TEMPERATE.addLandBiome(20, BiomeGenBase.plains).addLandBiome(10, BiomeGenBase.taiga).addLandBiome(10, BiomeGenBase.forest).addLandBiome(10, BiomeGenBase.birchForest);
BOPClimates.WARM_TEMPERATE.addLandBiome(20, BiomeGenBase.plains).addLandBiome(10, BiomeGenBase.roofedForest).addLandBiome(10, BiomeGenBase.forest).addLandBiome(10, BiomeGenBase.birchForest);
BOPClimates.HOT_SWAMP.addLandBiome(10, BiomeGenBase.swampland);
BOPClimates.TROPICAL.addLandBiome(10, BiomeGenBase.jungle);
BOPClimates.MEDITERANEAN.addLandBiome(5, BiomeGenBase.plains).addLandBiome(5, BiomeGenBase.mesa);
BOPClimates.SAVANNA.addLandBiome(20, BiomeGenBase.savanna).addLandBiome(5, BiomeGenBase.mesa);
BOPClimates.HOT_DESERT.addLandBiome(30, BiomeGenBase.desert);
}
private static BOPClimates[] values = BOPClimates.values();
public static BOPClimates lookup(int i) {return values[i];}
// map temperature and rainfall to climates
// temperature values from 0 (cold) to 8 (hot) and rainfall values from 0 (wet) to 11 (dry), index is (temperatureValue * 12) + rainfallValue
// we will contrive to make any combination equally likely, so the overall rarity of each climate is in proportion to the number of times it appears in the array
private static final BOPClimates[] climateMapping = new BOPClimates[] {
// 0 1 2 3 4 5 6 7 8 9 10 11
ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, FROZEN_DESERT, FROZEN_DESERT, // 0
TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, COLD_DESERT, COLD_DESERT, // 1
BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, COLD_DESERT, // 2
COLD_SWAMP, WET_TEMPERATE, WET_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, DRY_TEMPERATE, COLD_DESERT, // 3
COLD_SWAMP, WET_TEMPERATE, WET_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, COLD_DESERT, // 4
COLD_SWAMP, COLD_SWAMP, WET_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, // 5
COLD_SWAMP, COLD_SWAMP, WET_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, // 6
HOT_SWAMP, HOT_SWAMP, TROPICAL, TROPICAL, TROPICAL, MEDITERANEAN, MEDITERANEAN, MEDITERANEAN, MEDITERANEAN, HOT_DESERT, HOT_DESERT, HOT_DESERT, // 7
HOT_SWAMP, HOT_SWAMP, TROPICAL, TROPICAL, TROPICAL, SAVANNA, SAVANNA, SAVANNA, SAVANNA, HOT_DESERT, HOT_DESERT, HOT_DESERT // 8
};
public static int[] getClimateMappingInts()
{
// 9 temperature values, 12 rainfall values, 12 * 9 = 108
int[] out = new int[108];
for (int i = 0; i < 108; i++)
{
out[i] = climateMapping[i].ordinal();
}
return out;
}
public static class WeightedBiomeEntry
{
public final int weight;
public final BiomeGenBase biome;
public WeightedBiomeEntry(int weight, BiomeGenBase biome)
{
this.weight = weight;
this.biome = biome;
}
}
// for debugging purposes
public static void printWeights()
{
for (BOPClimates climate : BOPClimates.values())
{
for (WeightedBiomeEntry entry : climate.landBiomes)
{
System.out.println(climate.name()+" "+entry.biome.biomeName+" "+entry.weight);
}
}
}
}

View file

@ -20,13 +20,11 @@ import java.util.Map.Entry;
import java.util.Set;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.IExtendedBiome;
import biomesoplenty.common.biome.BOPBiomeManager;
import biomesoplenty.common.biome.overworld.*;
import biomesoplenty.common.command.BOPCommand;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.util.biome.BiomeUtils;
import biomesoplenty.common.util.config.BOPConfig;
import biomesoplenty.common.world.WorldTypeBOP;
@ -148,12 +146,14 @@ public class ModBiomes
boreal_forest = registerBOPBiome(new BiomeGenBorealForest(), "Boreal Forest");
brushland = registerBOPBiome(new BiomeGenBrushland(), "Brushland");
canyon = registerBOPBiome(new BiomeGenCanyon(BiomeGenCanyon.CanyonType.PLATEAU), "Canyon");
crag = registerBOPBiome(new BiomeGenCrag(), "Crag");
chaparral = registerBOPBiome(new BiomeGenChaparral(), "Chaparral");
cherry_blossom_grove = registerBOPBiome(new BiomeGenCherryBlossomGrove(), "Cherry Blossom Grove");
coldDesert = registerBOPBiome(new BiomeGenColdDesert(BiomeGenColdDesert.ColdDesertType.COLD), "Cold Desert");
coniferous_forest = registerBOPBiome(new BiomeGenConiferousForest(), "Coniferous Forest");
crag = registerBOPBiome(new BiomeGenCrag(), "Crag");
denseForest = registerBOPBiome(new BiomeGenDenseForest(), "Dense Forest");
flowerField = registerBOPBiome(new BiomeGenFlowerField(), "Flower Field");
frozenDesert = registerBOPBiome(new BiomeGenColdDesert(BiomeGenColdDesert.ColdDesertType.FROZEN), "Frozen Desert");
grassland = registerBOPBiome(new BiomeGenGrassland(), "Grassland");
heathland = registerBOPBiome(new BiomeGenHeathland(), "Heathland");
highland = registerBOPBiome(new BiomeGenHighland(), "Highland");
@ -245,13 +245,13 @@ public class ModBiomes
BiomeGenBase.getBiomeGenArray()[id] = biome;
for (Entry<BiomeType, Integer> entry : ((IExtendedBiome)biome).getWeightMap().entrySet())
for (Entry<BOPClimates, Integer> entry : ((IExtendedBiome)biome).getWeightMap().entrySet())
{
if (entry != null)
{
BiomeType biomeType = entry.getKey();
BOPClimates climate = entry.getKey();
int weight = entry.getValue();
BOPBiomeManager.addBiome(biomeType, new BiomeEntry(biome, weight));
climate.addLandBiome(weight, biome);
}
}

View file

@ -85,7 +85,7 @@ public class ModBlocks
crag_rock = registerBlock( (new BlockBOPGeneric()).setStepSound(Block.soundTypeStone), "crag_rock" );
dried_dirt = registerBlock( (new BlockBOPGeneric()).addSupportedPlantType(EnumPlantType.Desert), "dried_dirt"); dried_dirt.setHarvestLevel("pickaxe",0);
hard_dirt = registerBlock( (new BlockBOPGeneric()).setHardness(0.7F), "hard_dirt" );
hard_ice = registerBlock( (new BlockBOPGeneric()).setHardness(0.75F), "hard_ice" );
hard_ice = registerBlock( (new BlockBOPGeneric(Material.packedIce)).setHardness(0.75F), "hard_ice" );
hard_sand = registerBlock( (new BlockBOPGeneric(Material.sand)).addSupportedPlantType(EnumPlantType.Desert).setHardness(0.9F).setStepSound(Block.soundTypeSand), "hard_sand" );
mud_brick_block = registerBlock( (new BlockBOPGeneric()).setResistance(2.0F), "mud_brick_block" );

View file

@ -1,41 +0,0 @@
package biomesoplenty.common.world;
import biomesoplenty.common.enums.BOPClimates;
import static biomesoplenty.common.enums.BOPClimates.*;
public class BOPBiomeManager {
// map temperature and rainfall to climates
// temperature values from 0 (cold) to 8 (hot) and rainfall values from 0 (wet) to 11 (dry), index is (temperatureValue * 12) + rainfallValue
// we will contrive to make any combination equally likely, so the overall rarity of each climate is in proportion to the number of times it appears in the array
private static final BOPClimates[] climateMapping = new BOPClimates[] {
// 0 1 2 3 4 5 6 7 8 9 10 11
ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, ICE_CAP, FROZEN_DESERT, FROZEN_DESERT, // 0
TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, TUNDRA, COLD_DESERT, COLD_DESERT, // 1
BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, BOREAL, COLD_DESERT, // 2
COLD_SWAMP, WET_TEMPERATE, WET_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, DRY_TEMPERATE, COLD_DESERT, // 3
COLD_SWAMP, WET_TEMPERATE, WET_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, COOL_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, COLD_DESERT, // 4
COLD_SWAMP, COLD_SWAMP, WET_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, // 5
COLD_SWAMP, COLD_SWAMP, WET_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, WARM_TEMPERATE, DRY_TEMPERATE, DRY_TEMPERATE, // 6
HOT_SWAMP, HOT_SWAMP, TROPICAL, TROPICAL, TROPICAL, MEDITERANEAN, MEDITERANEAN, MEDITERANEAN, MEDITERANEAN, HOT_DESERT, HOT_DESERT, HOT_DESERT, // 7
HOT_SWAMP, HOT_SWAMP, TROPICAL, TROPICAL, TROPICAL, SAVANNA, SAVANNA, SAVANNA, SAVANNA, HOT_DESERT, HOT_DESERT, HOT_DESERT // 8
};
public static int[] getClimateMappingInts()
{
// 9 temperature values, 12 rainfall values, 12 * 9 = 108
int[] out = new int[108];
for (int i = 0; i < 108; i++)
{
out[i] = climateMapping[i].ordinal();
}
return out;
}
public BOPBiomeManager() {
// TODO Auto-generated constructor stub
}
}

View file

@ -503,7 +503,7 @@ public class ChunkProviderGenerateBOP implements IChunkProvider
BlockPos target;
// add water lakes
if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !hasVillageGenerated && this.rand.nextInt(this.settings.waterLakeChance) == 0 && TerrainGen.populate(chunkProvider, worldObj, rand, chunkX, chunkZ, hasVillageGenerated, LAKE))
if (biomegenbase.rainfall > 0.01F && biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !hasVillageGenerated && this.rand.nextInt(this.settings.waterLakeChance) == 0 && TerrainGen.populate(chunkProvider, worldObj, rand, chunkX, chunkZ, hasVillageGenerated, LAKE))
{
target = decorateStart.add(this.rand.nextInt(16), this.rand.nextInt(256), this.rand.nextInt(16));
(new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, target);
@ -546,13 +546,14 @@ public class ChunkProviderGenerateBOP implements IChunkProvider
for (int j = 0; j < 16; ++j)
{
target = this.worldObj.getPrecipitationHeight(decorateStart.add(i, 0, j));
BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(target);
// if it's cold enough for ice, and there's exposed water, then freeze it
if (this.worldObj.canBlockFreezeWater(target.down()))
{
this.worldObj.setBlockState(target.down(), Blocks.ice.getDefaultState(), 2);
}
// if it's cold enough for snow, add a layer of snow
if (this.worldObj.canSnowAt(target, true))
if (biome.rainfall > 0.01F && this.worldObj.canSnowAt(target, true))
{
this.worldObj.setBlockState(target, Blocks.snow_layer.getDefaultState(), 2);
}

View file

@ -8,7 +8,6 @@
package biomesoplenty.common.world.layer;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
import biomesoplenty.common.enums.BOPClimates;
@ -27,6 +26,15 @@ public class GenLayerBiomeBOP extends GenLayer
this.landMassLayer = landMassLayer;
this.climateLayer = climateLayer;
this.settings = settings;
// debugging
BOPClimates.printWeights();
}
@Override
public int nextInt(int a)
{
return super.nextInt(a);
}
@ -49,74 +57,11 @@ public class GenLayerBiomeBOP extends GenLayer
if (landSeaVal == 0)
{
out[index] = 0;
out[index] = climate.getRandomOceanBiome(this).biomeID;
}
else
{
switch (climate)
{
case ICE_CAP:
out[index] = BiomeGenBase.icePlains.biomeID;
break;
case FROZEN_DESERT:
out[index] = BiomeGenBase.icePlains.biomeID;
break;
case TUNDRA:
out[index] = BiomeGenBase.coldTaiga.biomeID;
break;
case COLD_DESERT:
out[index] = BiomeGenBase.extremeHills.biomeID;
break;
case BOREAL:
out[index] = BiomeGenBase.coldTaiga.biomeID;
break;
case COLD_SWAMP:
out[index] = BiomeGenBase.plains.biomeID;
break;
case WET_TEMPERATE:
out[index] = BiomeGenBase.forest.biomeID;
break;
case DRY_TEMPERATE:
out[index] = BiomeGenBase.plains.biomeID;
break;
case COOL_TEMPERATE:
out[index] = BiomeGenBase.plains.biomeID;
break;
case WARM_TEMPERATE:
out[index] = BiomeGenBase.plains.biomeID;
break;
case HOT_SWAMP:
out[index] = BiomeGenBase.swampland.biomeID;
break;
case TROPICAL:
out[index] = BiomeGenBase.jungle.biomeID;
break;
case MEDITERANEAN:
out[index] = BiomeGenBase.mesa.biomeID;
break;
case SAVANNA:
out[index] = BiomeGenBase.savanna.biomeID;
break;
case HOT_DESERT:
out[index] = BiomeGenBase.desert.biomeID;
break;
}
out[index] = climate.getRandomLandBiome(this).biomeID;
}
}
}

View file

@ -1,6 +1,6 @@
package biomesoplenty.common.world.layer;
import biomesoplenty.common.world.BOPBiomeManager;
import biomesoplenty.common.enums.BOPClimates;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
@ -14,7 +14,7 @@ public class GenLayerClimate extends GenLayer {
super(seed);
this.temperature = temperature;
this.rainfall = rainfall;
this.climateMapping = BOPBiomeManager.getClimateMappingInts();
this.climateMapping = BOPClimates.getClimateMappingInts();
}
@Override