Added an attempt at making the beach the only biome that can be spawned on, will have to revisit it

This commit is contained in:
Adubbz 2014-01-14 19:33:34 +11:00
parent dcbb378720
commit cd09802a37

View file

@ -1,6 +1,13 @@
package biomesoplenty.common.core; package biomesoplenty.common.core;
import static biomesoplenty.api.BOPBiomeHelper.get;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraftforge.common.BiomeManager;
import biomesoplenty.api.BOPBiomeHelper; import biomesoplenty.api.BOPBiomeHelper;
import biomesoplenty.api.BOPBiomeHelper.BOPBiomeListEntry; import biomesoplenty.api.BOPBiomeHelper.BOPBiomeListEntry;
import biomesoplenty.api.BOPBiomeHelper.BOPBiomeTemperatureType; import biomesoplenty.api.BOPBiomeHelper.BOPBiomeTemperatureType;
@ -76,6 +83,7 @@ public class BOPBiomes
{ {
registerBiomes(); registerBiomes();
useOnlyBiome(); useOnlyBiome();
addSpawnBiomes();
} }
private static void registerBiomes() private static void registerBiomes()
@ -165,6 +173,41 @@ public class BOPBiomes
registerBiome(new BOPBiomeListEntry(new BiomeGenWoodland(BOPConfigurationIDs.woodlandID).setBiomeName("Woodland"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenWoodland(BOPConfigurationIDs.woodlandID).setBiomeName("Woodland"), BOPBiomeTemperatureType.WARM));
} }
private static void addSpawnBiomes()
{
//TODO: Spawn only on beaches.
clearAllSpawnBiomes();
addSpawnBiome(BiomeGenBase.beach);
}
public static void registerOnlyBiome(BOPBiomeListEntry biome)
{
onlyBiome = biome.biome;
}
public static void registerBiome(BOPBiomeListEntry biome)
{
BOPBiomeHelper.registerBiome(biome.biome, StringUtils.remove(StringUtils.uncapitalize(WordUtils.capitalize(biome.biome.biomeName)), " "));
addBiomeToList(biome);
}
public static void addBiomeToList(BOPBiomeListEntry biome)
{
BOPBiomeHelper.getCorrespondingTemperatureTypeList(biome.temperatureType).add(biome.biome);
}
public static void addSpawnBiome(BiomeGenBase biome)
{
BiomeManager.addSpawnBiome(biome);
}
public static void clearAllSpawnBiomes()
{
WorldChunkManager.allowedBiomes.clear();
}
private static void useOnlyBiome() private static void useOnlyBiome()
{ {
if (onlyBiome != null) if (onlyBiome != null)
@ -176,20 +219,4 @@ public class BOPBiomes
} }
} }
} }
public static void registerOnlyBiome(BOPBiomeListEntry biome)
{
onlyBiome = biome.biome;
}
public static void registerBiome(BOPBiomeListEntry biome)
{
BOPBiomeHelper.registerBiome(biome.biome, biome.biome.biomeName);
addBiomeToList(biome);
}
public static void addBiomeToList(BOPBiomeListEntry biome)
{
BOPBiomeHelper.getCorrespondingTemperatureTypeList(biome.temperatureType).add(biome.biome);
}
} }