2012-10-28 14:38:38 +00:00
|
|
|
package net.minecraftforge.common;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2014-04-11 01:01:28 +00:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
2012-10-28 14:38:38 +00:00
|
|
|
|
2014-04-11 01:01:28 +00:00
|
|
|
import net.minecraft.util.WeightedRandom;
|
|
|
|
import net.minecraft.world.WorldType;
|
2012-12-13 05:58:35 +00:00
|
|
|
import net.minecraft.world.biome.BiomeGenBase;
|
|
|
|
import net.minecraft.world.gen.structure.MapGenVillage;
|
|
|
|
import net.minecraft.world.biome.WorldChunkManager;
|
2012-10-28 14:38:38 +00:00
|
|
|
|
|
|
|
public class BiomeManager
|
|
|
|
{
|
2014-04-11 01:01:28 +00:00
|
|
|
public static List<BiomeEntry> desertBiomes = new ArrayList<BiomeEntry>();
|
|
|
|
public static List<BiomeEntry> warmBiomes = new ArrayList<BiomeEntry>();
|
|
|
|
public static List<BiomeEntry> coolBiomes = new ArrayList<BiomeEntry>();
|
|
|
|
public static List<BiomeEntry> icyBiomes = new ArrayList<BiomeEntry>();
|
|
|
|
|
|
|
|
public static List<BiomeGenBase> oceanBiomes = new ArrayList<BiomeGenBase>();
|
|
|
|
|
2013-12-22 23:47:51 +00:00
|
|
|
public static ArrayList<BiomeGenBase> strongHoldBiomes = new ArrayList<BiomeGenBase>();
|
|
|
|
public static ArrayList<BiomeGenBase> strongHoldBiomesBlackList = new ArrayList<BiomeGenBase>();
|
|
|
|
|
2014-04-11 01:01:28 +00:00
|
|
|
static
|
|
|
|
{
|
|
|
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10));
|
|
|
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.roofedForest, 10));
|
|
|
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10));
|
|
|
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
|
|
|
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.birchForest, 10));
|
|
|
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.swampland, 10));
|
|
|
|
|
|
|
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10));
|
|
|
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10));
|
|
|
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.taiga, 10));
|
|
|
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
|
|
|
|
|
|
|
|
icyBiomes.add(new BiomeEntry(BiomeGenBase.icePlains, 30));
|
|
|
|
icyBiomes.add(new BiomeEntry(BiomeGenBase.coldTaiga, 10));
|
|
|
|
|
|
|
|
oceanBiomes.add(BiomeGenBase.ocean);
|
|
|
|
oceanBiomes.add(BiomeGenBase.deepOcean);
|
|
|
|
oceanBiomes.add(BiomeGenBase.frozenOcean);
|
|
|
|
}
|
|
|
|
|
2014-01-18 05:55:48 +00:00
|
|
|
@SuppressWarnings("unchecked")
|
2012-10-28 14:38:38 +00:00
|
|
|
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
|
|
|
|
{
|
|
|
|
if (!MapGenVillage.villageSpawnBiomes.contains(biome))
|
|
|
|
{
|
|
|
|
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
|
|
|
biomes.add(biome);
|
|
|
|
MapGenVillage.villageSpawnBiomes = biomes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-18 05:55:48 +00:00
|
|
|
@SuppressWarnings("unchecked")
|
2012-10-28 14:38:38 +00:00
|
|
|
public static void removeVillageBiome(BiomeGenBase biome)
|
|
|
|
{
|
|
|
|
if (MapGenVillage.villageSpawnBiomes.contains(biome))
|
|
|
|
{
|
|
|
|
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
|
|
|
biomes.remove(biome);
|
|
|
|
MapGenVillage.villageSpawnBiomes = biomes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void addStrongholdBiome(BiomeGenBase biome)
|
|
|
|
{
|
2013-12-22 23:47:51 +00:00
|
|
|
if (!strongHoldBiomes.contains(biome))
|
2012-10-28 14:38:38 +00:00
|
|
|
{
|
2013-12-22 23:47:51 +00:00
|
|
|
strongHoldBiomes.add(biome);
|
2012-10-28 14:38:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void removeStrongholdBiome(BiomeGenBase biome)
|
|
|
|
{
|
2013-12-22 23:47:51 +00:00
|
|
|
if (!strongHoldBiomesBlackList.contains(biome))
|
2012-10-28 14:38:38 +00:00
|
|
|
{
|
2013-12-22 23:47:51 +00:00
|
|
|
strongHoldBiomesBlackList.add(biome);
|
2012-10-28 14:38:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void addSpawnBiome(BiomeGenBase biome)
|
|
|
|
{
|
|
|
|
if (!WorldChunkManager.allowedBiomes.contains(biome))
|
|
|
|
{
|
|
|
|
WorldChunkManager.allowedBiomes.add(biome);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void removeSpawnBiome(BiomeGenBase biome)
|
|
|
|
{
|
|
|
|
if (WorldChunkManager.allowedBiomes.contains(biome))
|
|
|
|
{
|
|
|
|
WorldChunkManager.allowedBiomes.remove(biome);
|
|
|
|
}
|
|
|
|
}
|
2014-04-11 01:01:28 +00:00
|
|
|
|
|
|
|
public static class BiomeEntry extends WeightedRandom.Item
|
|
|
|
{
|
|
|
|
public final BiomeGenBase biome;
|
|
|
|
|
|
|
|
public BiomeEntry(BiomeGenBase biome, int weight)
|
|
|
|
{
|
|
|
|
super(weight);
|
|
|
|
|
|
|
|
this.biome = biome;
|
|
|
|
}
|
|
|
|
}
|
2012-10-28 14:38:38 +00:00
|
|
|
}
|