@Override
protected void load(WorldGenerator generator, File file) throws Exception {
// prepare to read the meta data
YamlConfiguration metaYaml = new YamlConfiguration();
metaYaml.options().header("CityWorld/WorldEdit schematic configuration");
metaYaml.options().copyDefaults(true);
// add the defaults
metaYaml.addDefault(tagGroundLevelY, groundLevelY);
metaYaml.addDefault(tagFlipableX, flipableX);
metaYaml.addDefault(tagFlipableZ, flipableZ);
// metaYaml.addDefault(tagScalableX, ScalableX);
// metaYaml.addDefault(tagScalableZ, ScalableZ);
// metaYaml.addDefault(tagScalableY, ScalableY);
// metaYaml.addDefault(tagFloorHeightY, FloorHeightY);
metaYaml.addDefault(tagOddsOfAppearance, oddsOfAppearance);
metaYaml.addDefault(tagBroadcastLocation, broadcastLocation);
metaYaml.addDefault(tagDecayable, decayable);
// start reading it
File metaFile = new File(file.getAbsolutePath() + metaExtension);
if (metaFile.exists()) {
metaYaml.load(metaFile);
groundLevelY = Math.max(0, metaYaml.getInt(tagGroundLevelY, groundLevelY));
flipableX = metaYaml.getBoolean(tagFlipableX, flipableX);
flipableZ = metaYaml.getBoolean(tagFlipableZ, flipableZ);
// ScalableX = metaYaml.getBoolean(tagScalableX, ScalableX) && sizeX == 3;
// ScalableZ = metaYaml.getBoolean(tagScalableZ, ScalableZ) && sizeZ == 3;
// ScalableY = metaYaml.getBoolean(tagScalableY, ScalableY);
// FloorHeightY = Math.max(2, Math.min(16, metaYaml.getInt(tagFloorHeightY, FloorHeightY)));
oddsOfAppearance = Math.max(0.0, Math.min(1.0, metaYaml.getDouble(tagOddsOfAppearance, oddsOfAppearance)));
broadcastLocation = metaYaml.getBoolean(tagBroadcastLocation, broadcastLocation);
decayable = metaYaml.getBoolean(tagDecayable, decayable);
}
// load the actual blocks
CuboidClipboard cuboid = SchematicFormat.getFormat(file).load(file);
// how big is it?
sizeX = cuboid.getWidth();
sizeZ = cuboid.getLength();
sizeY = cuboid.getHeight();
//TODO Validate the size
// try and save the meta data if we can
try {
metaYaml.save(metaFile);
} catch (IOException e) {
// we can recover from this... so eat it!
generator.reportException("[WorldEdit] Could not resave " + metaFile.getAbsolutePath(), e);
}