// An empty CustomObjects instance with the global objects as fallback
// would work just as well
this.customObjects = TerrainControl.getCustomObjectManager().getGlobalObjects();
// Create WorldConfig
SettingsReader worldSettingsReader = new MemorySettingsReader(world.getName());
worldSettingsReader.putSetting(WorldStandardValues.WORLD_FOG, stream.readInt());
worldSettingsReader.putSetting(WorldStandardValues.WORLD_NIGHT_FOG, stream.readInt());
worldConfig = new WorldConfig(worldSettingsReader, world, customObjects);
// Custom biomes + ids
int count = stream.readInt();
while (count-- > 0)
{
String biomeName = ConfigFile.readStringFromStream(stream);
int id = stream.readInt();
worldConfig.customBiomeGenerationIds.put(biomeName, id);
}
// BiomeConfigs
StandardBiomeTemplate defaultSettings = new StandardBiomeTemplate(worldConfig.worldHeightCap);
biomes = new LocalBiome[world.getMaxBiomesCount()];
count = stream.readInt();
while (count-- > 0)
{
int id = stream.readInt();
String biomeName = ConfigFile.readStringFromStream(stream);
SettingsReader biomeReader = new MemorySettingsReader(biomeName);
biomeReader.putSetting(BiomeStandardValues.BIOME_TEMPERATURE, stream.readFloat());
biomeReader.putSetting(BiomeStandardValues.BIOME_WETNESS, stream.readFloat());
biomeReader.putSetting(BiomeStandardValues.SKY_COLOR, stream.readInt());
biomeReader.putSetting(BiomeStandardValues.WATER_COLOR, stream.readInt());
biomeReader.putSetting(BiomeStandardValues.GRASS_COLOR, stream.readInt());
biomeReader.putSetting(BiomeStandardValues.GRASS_COLOR_IS_MULTIPLIER, stream.readBoolean());
biomeReader.putSetting(BiomeStandardValues.FOLIAGE_COLOR, stream.readInt());
biomeReader.putSetting(BiomeStandardValues.FOLIAGE_COLOR_IS_MULTIPLIER, stream.readBoolean());
BiomeLoadInstruction instruction = new BiomeLoadInstruction(biomeName, id, defaultSettings);
BiomeConfig config = new BiomeConfig(biomeReader, instruction, worldConfig);
config.process();
LocalBiome biome = world.createBiomeFor(config, new BiomeIds(id));