use of org.pepsoft.worldpainter.layers.exporters.ResourcesExporter.ResourcesExporterSettings in project WorldPainter by Captain-Chaos.
the class Configuration method readObject.
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
// Legacy config
if ((border != null) && (border2 == null)) {
border2 = Border.valueOf(border.name());
border = null;
}
if (customMaterials == null) {
customMaterials = new Material[] { Material.DIRT, Material.DIRT, Material.DIRT, Material.DIRT, Material.DIRT };
}
if (minecraftJars == null) {
minecraftJars = new HashMap<>();
minecraft1_9_p3Jar = null;
}
if (uuid == null) {
uuid = UUID.randomUUID();
}
if (undoLevels == 0) {
checkForUpdates = true;
undoEnabled = true;
defaultContoursEnabled = true;
undoLevels = 100;
defaultGridSize = 128;
defaultContourSeparation = 10;
defaultWidth = 5;
defaultHeight = 5;
defaultMaxHeight = DEFAULT_MAX_HEIGHT_2;
}
if (defaultTerrainAndLayerSettings == null) {
defaultTerrainAndLayerSettings = new Dimension(World2.DEFAULT_OCEAN_SEED, TileFactoryFactory.createNoiseTileFactory(new Random().nextLong(), surface, defaultMaxHeight, level, waterLevel, lava, beaches, 20, 1.0), Constants.DIM_NORMAL, defaultMaxHeight);
}
// New legacy mechanism with version number
if (version < 1) {
worldFileBackups = 3;
}
if (version < 2) {
defaultRange = 20;
defaultScale = 1.0;
defaultLightOrigin = LightOrigin.NORTHWEST;
}
if (version < 3) {
String maxRadiusStr = System.getProperty("org.pepsoft.worldpainter.maxRadius");
if ((maxRadiusStr != null) && (!maxRadiusStr.trim().isEmpty())) {
try {
maximumBrushSize = Integer.parseInt(maxRadiusStr);
} catch (NumberFormatException e) {
maximumBrushSize = 300;
}
} else {
maximumBrushSize = 300;
}
}
if (version < 4) {
// Turn on smooth snow for everyone once
FrostSettings frostSettings = (FrostSettings) defaultTerrainAndLayerSettings.getLayerSettings(Frost.INSTANCE);
if (frostSettings != null) {
frostSettings.setMode(FrostSettings.MODE_SMOOTH);
}
}
if (version < 5) {
// Reset the Resource setting preferences once, which might have
// been unintentionally altered due to a bug
defaultTerrainAndLayerSettings.setLayerSettings(Resources.INSTANCE, new ResourcesExporterSettings(defaultMaxHeight));
}
if (version < 6) {
if (!Boolean.FALSE.equals(pingAllowed)) {
eventLog = new LinkedList<>();
}
}
if (version < 7) {
customLayers = new ArrayList<>();
mixedMaterials = new ArrayList<>();
}
if (version < 8) {
// continue to the top of the map
if ((defaultTerrainAndLayerSettings.getTileFactory() instanceof HeightMapTileFactory) && (((HeightMapTileFactory) defaultTerrainAndLayerSettings.getTileFactory()).getTheme() instanceof SimpleTheme)) {
SimpleTheme theme = (SimpleTheme) ((HeightMapTileFactory) defaultTerrainAndLayerSettings.getTileFactory()).getTheme();
// luck; it's not worth migrating them as well
if (theme.getTerrainRanges() != null) {
SortedMap<Integer, Terrain> terrainRanges = theme.getTerrainRanges();
Map<Filter, Layer> layerMap = new HashMap<>();
boolean frostAdded = false;
for (Map.Entry<Integer, Terrain> entry : terrainRanges.entrySet()) {
if (entry.getValue() == Terrain.SNOW) {
if (!frostAdded) {
layerMap.put(new HeightFilter(defaultMaxHeight, entry.getKey(), defaultMaxHeight - 1, theme.isRandomise()), Frost.INSTANCE);
frostAdded = true;
}
entry.setValue(Terrain.ROCK);
}
}
if (!layerMap.isEmpty()) {
theme.setLayerMap(layerMap);
}
}
}
}
if (version < 9) {
// Set default export settings
defaultCreateGoodiesChest = true;
defaultGenerator = Generator.DEFAULT;
defaultMapFeatures = true;
defaultGameType = 0;
}
if (version < 10) {
if (defaultTerrainAndLayerSettings.getSubsurfaceMaterial() == Terrain.STONE) {
defaultTerrainAndLayerSettings.setSubsurfaceMaterial(Terrain.STONE_MIX);
}
}
if (version < 11) {
switch(SystemUtils.getOS()) {
case WINDOWS:
accelerationType = AccelerationType.DIRECT3D;
break;
case MAC:
accelerationType = AccelerationType.DEFAULT;
break;
case LINUX:
accelerationType = AccelerationType.XRENDER;
break;
default:
accelerationType = AccelerationType.DEFAULT;
break;
}
// Previous default; principle of least surprise:
overlayType = OverlayType.SCALE_ON_LOAD;
}
if (version < 12) {
defaultJideLayoutData = null;
jideLayoutData = null;
showCalloutCount = 3;
}
if (version < 13) {
backgroundImageMode = TiledImageViewer.BackgroundImageMode.REPEAT;
backgroundColour = -1;
showBiomes = showBorders = true;
}
if (version < 14) {
if (defaultGameType >= 0) {
defaultGameTypeObj = GameType.values()[defaultGameType];
defaultGameType = -1;
} else {
// Not sure how this could have happened, but it has been
// observed
defaultGameTypeObj = GameType.SURVIVAL;
defaultGameType = -1;
}
}
if (version < 15) {
defaultPlatform = DefaultPlugin.JAVA_ANVIL;
exportDirectories = new HashMap<>();
if (exportDirectory != null) {
exportDirectories.put(DefaultPlugin.JAVA_ANVIL, exportDirectory);
exportDirectories.put(DefaultPlugin.JAVA_MCREGION, exportDirectory);
exportDirectory = null;
}
}
version = CURRENT_VERSION;
// Bug fix: make sure terrain ranges map conforms to surface material setting
TileFactory tileFactory = defaultTerrainAndLayerSettings.getTileFactory();
if ((tileFactory instanceof HeightMapTileFactory) && (((HeightMapTileFactory) tileFactory).getTheme() instanceof SimpleTheme)) {
SortedMap<Integer, Terrain> defaultTerrainRanges = ((SimpleTheme) ((HeightMapTileFactory) tileFactory).getTheme()).getTerrainRanges();
// Find what is probably meant to be the surface material. With the
// default settings this should be -1, but if someone configured a
// default underwater material, try not to change that
int surfaceLevel = defaultTerrainRanges.headMap(waterLevel + 3).lastKey();
defaultTerrainRanges.put(surfaceLevel, surface);
}
}
use of org.pepsoft.worldpainter.layers.exporters.ResourcesExporter.ResourcesExporterSettings in project WorldPainter by Captain-Chaos.
the class JavaMapImporter method doImport.
public World2 doImport(ProgressReceiver progressReceiver) throws IOException, ProgressReceiver.OperationCancelled {
long start = System.currentTimeMillis();
logger.info("Importing map from " + levelDatFile.getAbsolutePath());
Level level = Level.load(levelDatFile);
int version = level.getVersion();
if ((version != SUPPORTED_VERSION_1) && (version != SUPPORTED_VERSION_2)) {
throw new UnsupportedOperationException("Level format version " + version + " not supported");
}
String name = level.getName().trim();
int maxHeight = level.getMaxHeight();
World2 world = new World2((version == SUPPORTED_VERSION_1) ? JAVA_MCREGION : JAVA_ANVIL, maxHeight);
world.addHistoryEntry(HistoryEntry.WORLD_IMPORTED_FROM_MINECRAFT_MAP, level.getName(), levelDatFile.getParentFile());
world.setCreateGoodiesChest(false);
world.setName(name);
world.setSpawnPoint(new Point(level.getSpawnX(), level.getSpawnZ()));
world.setImportedFrom(levelDatFile);
world.setMapFeatures(level.isMapFeatures());
if (level.isHardcore()) {
world.setGameType(GameType.HARDCORE);
} else {
world.setGameType(GameType.values()[level.getGameType()]);
}
world.setGenerator(level.getGenerator());
world.setGeneratorOptions(level.getGeneratorOptions());
world.setDifficulty(level.getDifficulty());
if ((version == SUPPORTED_VERSION_2) && (level.getBorderSize() > 0.0)) {
// If the world is version 0x4abd and actually has border settings,
// load them
world.getBorderSettings().setCentreX((int) (level.getBorderCenterX() + 0.5));
world.getBorderSettings().setCentreY((int) (level.getBorderCenterZ() + 0.5));
world.getBorderSettings().setSize((int) (level.getBorderSize() + 0.5));
world.getBorderSettings().setSafeZone((int) (level.getBorderSafeZone() + 0.5));
world.getBorderSettings().setWarningBlocks((int) (level.getBorderWarningBlocks() + 0.5));
world.getBorderSettings().setWarningTime((int) (level.getBorderWarningTime() + 0.5));
world.getBorderSettings().setSizeLerpTarget((int) (level.getBorderSizeLerpTarget() + 0.5));
world.getBorderSettings().setSizeLerpTime((int) level.getBorderSizeLerpTime());
world.getBorderSettings().setDamagePerBlock((int) (level.getBorderDamagePerBlock() + 0.5));
}
File worldDir = levelDatFile.getParentFile();
File regionDir = new File(worldDir, "region");
File netherDir = new File(worldDir, "DIM-1/region");
File endDir = new File(worldDir, "DIM1/region");
int dimCount = 1;
if (netherDir.isDirectory() && dimensionsToImport.contains(DIM_NETHER)) {
dimCount++;
}
if (endDir.isDirectory() && dimensionsToImport.contains(DIM_END)) {
dimCount++;
}
long minecraftSeed = level.getSeed();
tileFactory.setSeed(minecraftSeed);
Dimension dimension = new Dimension(minecraftSeed, tileFactory, DIM_NORMAL, maxHeight);
dimension.setEventsInhibited(true);
try {
dimension.setCoverSteepTerrain(false);
dimension.setSubsurfaceMaterial(Terrain.STONE);
dimension.setBorderLevel(62);
// Turn off smooth snow
FrostSettings frostSettings = new FrostSettings();
frostSettings.setMode(FrostSettings.MODE_FLAT);
dimension.setLayerSettings(Frost.INSTANCE, frostSettings);
ResourcesExporterSettings resourcesSettings = (ResourcesExporterSettings) dimension.getLayerSettings(Resources.INSTANCE);
resourcesSettings.setMinimumLevel(0);
if (version == SUPPORTED_VERSION_1) {
resourcesSettings.setChance(BLK_EMERALD_ORE, 0);
}
Configuration config = Configuration.getInstance();
dimension.setGridEnabled(config.isDefaultGridEnabled());
dimension.setGridSize(config.getDefaultGridSize());
dimension.setContoursEnabled(config.isDefaultContoursEnabled());
dimension.setContourSeparation(config.getDefaultContourSeparation());
String dimWarnings = importDimension(regionDir, dimension, version, (progressReceiver != null) ? new SubProgressReceiver(progressReceiver, 0.0f, 1.0f / dimCount) : null);
if (dimWarnings != null) {
if (warnings == null) {
warnings = dimWarnings;
} else {
warnings = warnings + dimWarnings;
}
}
} finally {
dimension.setEventsInhibited(false);
}
world.addDimension(dimension);
int dimNo = 1;
if (netherDir.isDirectory() && dimensionsToImport.contains(DIM_NETHER)) {
HeightMapTileFactory netherTileFactory = TileFactoryFactory.createNoiseTileFactory(minecraftSeed + 1, Terrain.NETHERRACK, maxHeight, 188, 192, true, false, 20f, 1.0);
SimpleTheme theme = (SimpleTheme) netherTileFactory.getTheme();
SortedMap<Integer, Terrain> terrainRanges = theme.getTerrainRanges();
terrainRanges.clear();
terrainRanges.put(-1, Terrain.NETHERRACK);
theme.setTerrainRanges(terrainRanges);
theme.setLayerMap(null);
dimension = new Dimension(minecraftSeed + 1, netherTileFactory, DIM_NETHER, maxHeight);
dimension.setEventsInhibited(true);
try {
dimension.setCoverSteepTerrain(false);
dimension.setSubsurfaceMaterial(Terrain.NETHERRACK);
ResourcesExporterSettings resourcesSettings = (ResourcesExporterSettings) dimension.getLayerSettings(Resources.INSTANCE);
resourcesSettings.setMinimumLevel(0);
if (version == SUPPORTED_VERSION_1) {
resourcesSettings.setChance(BLK_QUARTZ_ORE, 0);
}
String dimWarnings = importDimension(netherDir, dimension, version, (progressReceiver != null) ? new SubProgressReceiver(progressReceiver, (float) dimNo++ / dimCount, 1.0f / dimCount) : null);
if (dimWarnings != null) {
if (warnings == null) {
warnings = dimWarnings;
} else {
warnings = warnings + dimWarnings;
}
}
} finally {
dimension.setEventsInhibited(false);
}
world.addDimension(dimension);
}
if (endDir.isDirectory() && dimensionsToImport.contains(DIM_END)) {
HeightMapTileFactory endTileFactory = TileFactoryFactory.createNoiseTileFactory(minecraftSeed + 2, Terrain.END_STONE, maxHeight, 32, 0, false, false, 20f, 1.0);
SimpleTheme theme = (SimpleTheme) endTileFactory.getTheme();
SortedMap<Integer, Terrain> terrainRanges = theme.getTerrainRanges();
terrainRanges.clear();
terrainRanges.put(-1, Terrain.END_STONE);
theme.setTerrainRanges(terrainRanges);
theme.setLayerMap(Collections.emptyMap());
dimension = new Dimension(minecraftSeed + 2, endTileFactory, DIM_END, maxHeight);
dimension.setEventsInhibited(true);
try {
dimension.setCoverSteepTerrain(false);
dimension.setSubsurfaceMaterial(Terrain.END_STONE);
String dimWarnings = importDimension(endDir, dimension, version, (progressReceiver != null) ? new SubProgressReceiver(progressReceiver, (float) dimNo / dimCount, 1.0f / dimCount) : null);
if (dimWarnings != null) {
if (warnings == null) {
warnings = dimWarnings;
} else {
warnings = warnings + dimWarnings;
}
}
} finally {
dimension.setEventsInhibited(false);
}
world.addDimension(dimension);
}
// Log an event
Configuration config = Configuration.getInstance();
if (config != null) {
EventVO event = new EventVO(EVENT_KEY_ACTION_IMPORT_MAP).duration(System.currentTimeMillis() - start);
event.setAttribute(EventVO.ATTRIBUTE_TIMESTAMP, new Date(start));
event.setAttribute(ATTRIBUTE_KEY_MAX_HEIGHT, world.getMaxHeight());
event.setAttribute(ATTRIBUTE_KEY_PLATFORM, world.getPlatform().displayName);
event.setAttribute(ATTRIBUTE_KEY_MAP_FEATURES, world.isMapFeatures());
event.setAttribute(ATTRIBUTE_KEY_GAME_TYPE_NAME, world.getGameType().name());
event.setAttribute(ATTRIBUTE_KEY_ALLOW_CHEATS, world.isAllowCheats());
event.setAttribute(ATTRIBUTE_KEY_GENERATOR, world.getGenerator().name());
if (world.getPlatform().equals(JAVA_ANVIL) && (world.getGenerator() == Generator.FLAT)) {
event.setAttribute(ATTRIBUTE_KEY_GENERATOR_OPTIONS, world.getGeneratorOptions());
}
event.setAttribute(ATTRIBUTE_KEY_TILES, dimension.getTiles().size());
config.logEvent(event);
}
return world;
}
use of org.pepsoft.worldpainter.layers.exporters.ResourcesExporter.ResourcesExporterSettings in project WorldPainter by Captain-Chaos.
the class Dimension method init.
private void init() {
listeners = new ArrayList<>();
dirtyTiles = new HashSet<>();
addedTiles = new HashSet<>();
removedTiles = new HashSet<>();
propertyChangeSupport = new PropertyChangeSupport(this);
garden = new WPGarden();
topLayerDepthNoise = new PerlinNoise(seed + TOP_LAYER_DEPTH_SEED_OFFSET);
for (Tile tile : tiles.values()) {
tile.addListener(this);
Set<Seed> seeds = tile.getSeeds();
if (seeds != null) {
for (Seed gardenSeed : seeds) {
gardenSeed.garden = garden;
}
}
}
// Legacy support
if (wpVersion < 1) {
if (borderSize == 0) {
borderSize = 2;
}
if (overlayScale == 0.0f) {
overlayScale = 1.0f;
}
if (overlayTransparency == 0.0f) {
overlayTransparency = 0.5f;
}
if (gridSize == 0) {
gridSize = 128;
}
if (!biomesConverted) {
// Convert the nibble sized biomes data from a legacy map (by
// deleting it so that it will be recalculated
tiles.values().forEach(org.pepsoft.worldpainter.Tile::convertBiomeData);
biomesConverted = true;
}
if (maxHeight == 0) {
maxHeight = 128;
}
if (subsurfaceMaterial == Terrain.RESOURCES) {
subsurfaceMaterial = Terrain.STONE;
// Load legacy settings
ResourcesExporterSettings settings = new ResourcesExporterSettings(maxHeight);
settings.setChance(BLK_GOLD_ORE, 1);
settings.setChance(BLK_IRON_ORE, 5);
settings.setChance(BLK_COAL, 9);
settings.setChance(BLK_LAPIS_LAZULI_ORE, 1);
settings.setChance(BLK_DIAMOND_ORE, 1);
settings.setChance(BLK_REDSTONE_ORE, 6);
settings.setChance(BLK_WATER, 1);
settings.setChance(BLK_LAVA, 1);
settings.setChance(BLK_DIRT, 9);
settings.setChance(BLK_GRAVEL, 9);
settings.setMaxLevel(BLK_GOLD_ORE, Terrain.GOLD_LEVEL);
settings.setMaxLevel(BLK_IRON_ORE, Terrain.IRON_LEVEL);
settings.setMaxLevel(BLK_COAL, Terrain.COAL_LEVEL);
settings.setMaxLevel(BLK_LAPIS_LAZULI_ORE, Terrain.LAPIS_LAZULI_LEVEL);
settings.setMaxLevel(BLK_DIAMOND_ORE, Terrain.DIAMOND_LEVEL);
settings.setMaxLevel(BLK_REDSTONE_ORE, Terrain.REDSTONE_LEVEL);
settings.setMaxLevel(BLK_WATER, Terrain.WATER_LEVEL);
settings.setMaxLevel(BLK_LAVA, Terrain.LAVA_LEVEL);
settings.setMaxLevel(BLK_DIRT, Terrain.DIRT_LEVEL);
settings.setMaxLevel(BLK_GRAVEL, Terrain.GRAVEL_LEVEL);
layerSettings.put(Resources.INSTANCE, settings);
}
if (contourSeparation == 0) {
contourSeparation = 10;
}
if (topLayerMinDepth == 0) {
topLayerMinDepth = 3;
topLayerVariation = 4;
}
if (lastViewPosition == null) {
lastViewPosition = new Point();
}
if ((customLayers == null) || customLayers.isEmpty()) {
// The customLayers.isEmpty() is to fix a bug which escaped in a beta
customLayers = new ArrayList<>();
customLayers.addAll(getAllLayers(false).stream().filter(layer -> layer instanceof CustomLayer).map(layer -> (CustomLayer) layer).collect(Collectors.toList()));
}
}
if (wpVersion < 2) {
if (overlay != null) {
fixOverlayCoords = true;
}
}
if (wpVersion < 3) {
ceilingHeight = maxHeight;
}
wpVersion = CURRENT_WP_VERSION;
// Make sure that any custom layers which somehow ended up in the world
// are on the custom layer list so they will be added to a palette in
// the GUI. TODO: fix this properly
// Make sure customLayers isn't some weird read-only list
getAllLayers(false).stream().filter(layer -> (layer instanceof CustomLayer) && (!customLayers.contains(layer))).forEach(layer -> {
if ((!(customLayers instanceof ArrayList)) && (!(customLayers instanceof LinkedList))) {
// Make sure customLayers isn't some weird read-only list
customLayers = new ArrayList<>(customLayers);
}
customLayers.add((CustomLayer) layer);
});
}
use of org.pepsoft.worldpainter.layers.exporters.ResourcesExporter.ResourcesExporterSettings in project WorldPainter by Captain-Chaos.
the class DimensionPropertiesEditor method loadSettings.
private void loadSettings() {
int maxHeight = dimension.getMaxHeight() - 1;
// general
((SpinnerNumberModel) spinnerMinSurfaceDepth.getModel()).setMaximum(maxHeight);
spinnerMinSurfaceDepth.setValue(dimension.getTopLayerMinDepth());
((SpinnerNumberModel) spinnerMaxSurfaceDepth.getModel()).setMaximum(maxHeight);
spinnerMaxSurfaceDepth.setValue(dimension.getTopLayerMinDepth() + dimension.getTopLayerVariation());
if (dimension.getBorder() != null) {
switch(dimension.getBorder()) {
case LAVA:
radioButtonLavaBorder.setSelected(true);
radioButtonFixedBorder.setSelected(true);
break;
case WATER:
radioButtonWaterBorder.setSelected(true);
radioButtonFixedBorder.setSelected(true);
break;
case VOID:
radioButtonVoidBorder.setSelected(true);
radioButtonFixedBorder.setSelected(true);
break;
case ENDLESS_LAVA:
radioButtonLavaBorder.setSelected(true);
radioButtonEndlessBorder.setSelected(true);
break;
case ENDLESS_WATER:
radioButtonWaterBorder.setSelected(true);
radioButtonEndlessBorder.setSelected(true);
break;
case ENDLESS_VOID:
radioButtonVoidBorder.setSelected(true);
radioButtonEndlessBorder.setSelected(true);
break;
default:
throw new InternalError();
}
} else {
radioButtonNoBorder.setSelected(true);
}
((SpinnerNumberModel) spinnerBorderLevel.getModel()).setMaximum(maxHeight);
spinnerBorderLevel.setValue(dimension.getBorderLevel());
spinnerBorderSize.setValue(dimension.getBorderSize() * 128);
checkBoxBedrockWall.setSelected(dimension.isBedrockWall());
spinnerMinecraftSeed.setValue(dimension.getMinecraftSeed());
checkBoxBottomless.setSelected(dimension.isBottomless());
checkBoxCoverSteepTerrain.setSelected(dimension.isCoverSteepTerrain());
((SpinnerNumberModel) spinnerCeilingHeight.getModel()).setMaximum(maxHeight + 1);
spinnerCeilingHeight.setValue(dimension.getCeilingHeight());
// Minecraft world border
World2 world = dimension.getWorld();
if (world != null) {
World2.BorderSettings borderSettings = world.getBorderSettings();
spinnerMcBorderCentreX.setValue(borderSettings.getCentreX());
spinnerMcBorderCentreY.setValue(borderSettings.getCentreY());
spinnerMcBorderSize.setValue(borderSettings.getSize());
// spinnerMcBorderBuffer.setValue(borderSettings.getSafeZone());
// spinnerMcBorderDamage.setValue(borderSettings.getDamagePerBlock());
// spinnerMcBorderWarningTime.setValue(borderSettings.getWarningTime());
// spinnerMcBorderWarningDistance.setValue(borderSettings.getWarningBlocks());
} else {
spinnerMcBorderCentreX.setEnabled(false);
spinnerMcBorderCentreY.setEnabled(false);
spinnerMcBorderSize.setEnabled(false);
// spinnerMcBorderBuffer.setEnabled(false);
// spinnerMcBorderDamage.setEnabled(false);
// spinnerMcBorderWarningTime.setEnabled(false);
// spinnerMcBorderWarningDistance.setEnabled(false);
}
List<Terrain> materialList = new ArrayList<>(Arrays.asList(Terrain.VALUES));
for (Iterator<Terrain> i = materialList.iterator(); i.hasNext(); ) {
Terrain terrain = i.next();
if ((terrain.isCustom() && (!terrain.isConfigured())) || (terrain == Terrain.GRASS) || (terrain == Terrain.DESERT) || (terrain == Terrain.RED_DESERT)) {
i.remove();
}
}
comboBoxSubsurfaceMaterial.setModel(new DefaultComboBoxModel(materialList.toArray()));
comboBoxSubsurfaceMaterial.setSelectedItem(dimension.getSubsurfaceMaterial());
// caverns
CavernsSettings cavernsSettings = (CavernsSettings) dimension.getLayerSettings(Caverns.INSTANCE);
if (cavernsSettings == null) {
cavernsSettings = new CavernsSettings();
}
if (cavernsSettings.getCavernsEverywhereLevel() > 0) {
checkBoxCavernsEverywhere.setSelected(true);
sliderCavernsEverywhereLevel.setValue(cavernsSettings.getCavernsEverywhereLevel());
} else {
checkBoxCavernsEverywhere.setSelected(false);
sliderCavernsEverywhereLevel.setValue(8);
}
((SpinnerNumberModel) spinnerCavernsFloodLevel.getModel()).setMaximum(maxHeight);
if (cavernsSettings.getWaterLevel() > 0) {
checkBoxFloodCaverns.setSelected(true);
spinnerCavernsFloodLevel.setValue(cavernsSettings.getWaterLevel());
} else {
checkBoxFloodCaverns.setSelected(false);
spinnerCavernsFloodLevel.setValue(8);
}
checkBoxCavernsFloodWithLava.setSelected(cavernsSettings.isFloodWithLava());
checkBoxCavernsBreakSurface.setSelected(cavernsSettings.isSurfaceBreaking());
checkBoxCavernsRemoveWater.setSelected(!cavernsSettings.isLeaveWater());
((SpinnerNumberModel) spinnerCavernsMinLevel.getModel()).setMaximum(maxHeight);
spinnerCavernsMinLevel.setValue(cavernsSettings.getMinimumLevel());
((SpinnerNumberModel) spinnerCavernsMaxLevel.getModel()).setMaximum(maxHeight);
spinnerCavernsMaxLevel.setValue(Math.min(cavernsSettings.getMaximumLevel(), maxHeight));
// chasms
ChasmsSettings chasmsSettings = (ChasmsSettings) dimension.getLayerSettings(Chasms.INSTANCE);
if (chasmsSettings == null) {
chasmsSettings = new ChasmsSettings();
}
if (chasmsSettings.getChasmsEverywhereLevel() > 0) {
checkBoxChasmsEverywhere.setSelected(true);
sliderChasmsEverywhereLevel.setValue(chasmsSettings.getChasmsEverywhereLevel());
} else {
checkBoxChasmsEverywhere.setSelected(false);
sliderChasmsEverywhereLevel.setValue(8);
}
checkBoxChasmsBreakSurface.setSelected(chasmsSettings.isSurfaceBreaking());
((SpinnerNumberModel) spinnerChasmsMinLevel.getModel()).setMaximum(maxHeight);
spinnerChasmsMinLevel.setValue(chasmsSettings.getMinimumLevel());
((SpinnerNumberModel) spinnerChasmsMaxLevel.getModel()).setMaximum(maxHeight);
spinnerChasmsMaxLevel.setValue(Math.min(chasmsSettings.getMaximumLevel(), maxHeight));
// populate
checkBoxPopulate.setSelected(dimension.isPopulate());
// deciduous
TreeLayerSettings<DeciduousForest> deciduousSettings = (TreeLayerSettings<DeciduousForest>) dimension.getLayerSettings(DeciduousForest.INSTANCE);
if (deciduousSettings == null) {
deciduousSettings = new TreeLayerSettings<>(DeciduousForest.INSTANCE);
}
if (deciduousSettings.getMinimumLevel() > 0) {
checkBoxDeciduousEverywhere.setSelected(true);
sliderDeciduousLevel.setValue(deciduousSettings.getMinimumLevel());
} else {
checkBoxDeciduousEverywhere.setSelected(false);
sliderDeciduousLevel.setValue(8);
}
// pine
TreeLayerSettings<PineForest> pineSettings = (TreeLayerSettings<PineForest>) dimension.getLayerSettings(PineForest.INSTANCE);
if (pineSettings == null) {
pineSettings = new TreeLayerSettings<>(PineForest.INSTANCE);
}
if (pineSettings.getMinimumLevel() > 0) {
checkBoxPineEverywhere.setSelected(true);
sliderPineLevel.setValue(pineSettings.getMinimumLevel());
} else {
checkBoxPineEverywhere.setSelected(false);
sliderPineLevel.setValue(8);
}
// jungle
TreeLayerSettings<Jungle> jungleSettings = (TreeLayerSettings<Jungle>) dimension.getLayerSettings(Jungle.INSTANCE);
if (jungleSettings == null) {
jungleSettings = new TreeLayerSettings<>(Jungle.INSTANCE);
}
if (jungleSettings.getMinimumLevel() > 0) {
checkBoxJungleEverywhere.setSelected(true);
sliderJungleLevel.setValue(jungleSettings.getMinimumLevel());
} else {
checkBoxJungleEverywhere.setSelected(false);
sliderJungleLevel.setValue(8);
}
// swamp
TreeLayerSettings<SwampLand> swampLandSettings = (TreeLayerSettings<SwampLand>) dimension.getLayerSettings(SwampLand.INSTANCE);
if (swampLandSettings == null) {
swampLandSettings = new TreeLayerSettings<>(SwampLand.INSTANCE);
}
if (swampLandSettings.getMinimumLevel() > 0) {
checkBoxSwamplandEverywhere.setSelected(true);
jSlider6.setValue(swampLandSettings.getMinimumLevel());
} else {
checkBoxSwamplandEverywhere.setSelected(false);
jSlider6.setValue(8);
}
// frost
FrostSettings frostSettings = (FrostSettings) dimension.getLayerSettings(Frost.INSTANCE);
if (frostSettings == null) {
frostSettings = new FrostSettings();
}
checkBoxFrostEverywhere.setSelected(frostSettings.isFrostEverywhere());
checkBoxSmoothSnow.setSelected((frostSettings.getMode() == 2) || (frostSettings.getMode() == 3));
checkBoxSnowUnderTrees.setSelected(frostSettings.isSnowUnderTrees());
// resources
ResourcesExporterSettings resourcesSettings = (ResourcesExporterSettings) dimension.getLayerSettings(Resources.INSTANCE);
if (resourcesSettings == null) {
resourcesSettings = new ResourcesExporterSettings(dimension.getMaxHeight());
resourcesSettings.setMinimumLevel(0);
}
jCheckBox8.setSelected(resourcesSettings.isApplyEverywhere());
if (resourcesSettings.isApplyEverywhere()) {
jSlider4.setValue(resourcesSettings.getMinimumLevel());
} else {
jSlider4.setValue(8);
}
spinnerGoldChance.setValue(resourcesSettings.getChance(BLK_GOLD_ORE));
((SpinnerNumberModel) spinnerGoldMinLevel.getModel()).setMaximum(maxHeight);
spinnerGoldMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_GOLD_ORE), maxHeight));
((SpinnerNumberModel) spinnerGoldMaxLevel.getModel()).setMaximum(maxHeight);
spinnerGoldMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_GOLD_ORE), maxHeight));
spinnerIronChance.setValue(resourcesSettings.getChance(BLK_IRON_ORE));
((SpinnerNumberModel) spinnerIronMinLevel.getModel()).setMaximum(maxHeight);
spinnerIronMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_IRON_ORE), maxHeight));
((SpinnerNumberModel) spinnerIronMaxLevel.getModel()).setMaximum(maxHeight);
spinnerIronMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_IRON_ORE), maxHeight));
spinnerCoalChance.setValue(resourcesSettings.getChance(BLK_COAL));
((SpinnerNumberModel) spinnerCoalMinLevel.getModel()).setMaximum(maxHeight);
spinnerCoalMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_COAL), maxHeight));
((SpinnerNumberModel) spinnerCoalMaxLevel.getModel()).setMaximum(maxHeight);
spinnerCoalMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_COAL), maxHeight));
spinnerLapisChance.setValue(resourcesSettings.getChance(BLK_LAPIS_LAZULI_ORE));
((SpinnerNumberModel) spinnerLapisMinLevel.getModel()).setMaximum(maxHeight);
spinnerLapisMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_LAPIS_LAZULI_ORE), maxHeight));
((SpinnerNumberModel) spinnerLapisMaxLevel.getModel()).setMaximum(maxHeight);
spinnerLapisMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_LAPIS_LAZULI_ORE), maxHeight));
spinnerDiamondChance.setValue(resourcesSettings.getChance(BLK_DIAMOND_ORE));
((SpinnerNumberModel) spinnerDiamondMinLevel.getModel()).setMaximum(maxHeight);
spinnerDiamondMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_DIAMOND_ORE), maxHeight));
((SpinnerNumberModel) spinnerDiamondMaxLevel.getModel()).setMaximum(maxHeight);
spinnerDiamondMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_DIAMOND_ORE), maxHeight));
spinnerRedstoneChance.setValue(resourcesSettings.getChance(BLK_REDSTONE_ORE));
((SpinnerNumberModel) spinnerRedstoneMinLevel.getModel()).setMaximum(maxHeight);
spinnerRedstoneMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_REDSTONE_ORE), maxHeight));
((SpinnerNumberModel) spinnerRedstoneMaxLevel.getModel()).setMaximum(maxHeight);
spinnerRedstoneMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_REDSTONE_ORE), maxHeight));
spinnerWaterChance.setValue(resourcesSettings.getChance(BLK_WATER));
((SpinnerNumberModel) spinnerWaterMinLevel.getModel()).setMaximum(maxHeight);
spinnerWaterMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_WATER), maxHeight));
((SpinnerNumberModel) spinnerWaterMaxLevel.getModel()).setMaximum(maxHeight);
spinnerWaterMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_WATER), maxHeight));
spinnerLavaChance.setValue(resourcesSettings.getChance(BLK_LAVA));
((SpinnerNumberModel) spinnerLavaMinLevel.getModel()).setMaximum(maxHeight);
spinnerLavaMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_LAVA), maxHeight));
((SpinnerNumberModel) spinnerLavaMaxLevel.getModel()).setMaximum(maxHeight);
spinnerLavaMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_LAVA), maxHeight));
spinnerDirtChance.setValue(resourcesSettings.getChance(BLK_DIRT));
((SpinnerNumberModel) spinnerDirtMinLevel.getModel()).setMaximum(maxHeight);
spinnerDirtMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_DIRT), maxHeight));
((SpinnerNumberModel) spinnerDirtMaxLevel.getModel()).setMaximum(maxHeight);
spinnerDirtMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_DIRT), maxHeight));
spinnerGravelChance.setValue(resourcesSettings.getChance(BLK_GRAVEL));
((SpinnerNumberModel) spinnerGravelMinLevel.getModel()).setMaximum(maxHeight);
spinnerGravelMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_GRAVEL), maxHeight));
((SpinnerNumberModel) spinnerGravelMaxLevel.getModel()).setMaximum(maxHeight);
spinnerGravelMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_GRAVEL), maxHeight));
spinnerEmeraldChance.setValue(resourcesSettings.getChance(BLK_EMERALD_ORE));
((SpinnerNumberModel) spinnerEmeraldMinLevel.getModel()).setMaximum(maxHeight);
spinnerEmeraldMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_EMERALD_ORE), maxHeight));
((SpinnerNumberModel) spinnerEmeraldMaxLevel.getModel()).setMaximum(maxHeight);
spinnerEmeraldMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_EMERALD_ORE), maxHeight));
spinnerQuartzChance.setValue(resourcesSettings.getChance(BLK_QUARTZ_ORE));
((SpinnerNumberModel) spinnerQuartzMinLevel.getModel()).setMaximum(maxHeight);
spinnerQuartzMinLevel.setValue(clamp(resourcesSettings.getMinLevel(BLK_QUARTZ_ORE), maxHeight));
((SpinnerNumberModel) spinnerQuartzMaxLevel.getModel()).setMaximum(maxHeight);
spinnerQuartzMaxLevel.setValue(clamp(resourcesSettings.getMaxLevel(BLK_QUARTZ_ORE), maxHeight));
// terrain ranges
if (mode != Mode.EXPORT) {
if ((dimension.getTileFactory() instanceof HeightMapTileFactory) && (((HeightMapTileFactory) dimension.getTileFactory()).getTheme() instanceof SimpleTheme) && (((SimpleTheme) ((HeightMapTileFactory) dimension.getTileFactory()).getTheme()).getTerrainRanges() != null)) {
themeEditor.setTheme((SimpleTheme) ((HeightMapTileFactory) dimension.getTileFactory()).getTheme());
} else {
jTabbedPane1.setEnabledAt(1, false);
}
}
// annotations
AnnotationsSettings annotationsSettings = (AnnotationsSettings) dimension.getLayerSettings(Annotations.INSTANCE);
if (annotationsSettings == null) {
annotationsSettings = new AnnotationsSettings();
}
checkBoxExportAnnotations.setSelected(annotationsSettings.isExport());
// custom layers
if (mode == Mode.EXPORT) {
Set<CustomLayer> customLayers = App.getInstance().getCustomLayers();
// if (! customLayers.isEmpty()) {
customLayersTableModel = new CustomLayersTableModel(customLayers);
tableCustomLayers.setModel(customLayersTableModel);
// } else {
// jTabbedPane1.setEnabledAt(5, false);
// }
}
setControlStates();
}
use of org.pepsoft.worldpainter.layers.exporters.ResourcesExporter.ResourcesExporterSettings in project WorldPainter by Captain-Chaos.
the class DimensionPropertiesEditor method saveSettings.
public boolean saveSettings() {
int maxHeight = dimension.getMaxHeight() - 1;
// terrain ranges
if ((mode != Mode.EXPORT) && (!themeEditor.save())) {
jTabbedPane1.setSelectedIndex(1);
return false;
}
// general
int topLayerMinDepth = (Integer) spinnerMinSurfaceDepth.getValue();
dimension.setTopLayerMinDepth(topLayerMinDepth);
dimension.setTopLayerVariation((Integer) spinnerMaxSurfaceDepth.getValue() - topLayerMinDepth);
dimension.setSubsurfaceMaterial((Terrain) comboBoxSubsurfaceMaterial.getSelectedItem());
dimension.setBorder(getSelectedBorder());
dimension.setBorderLevel((Integer) spinnerBorderLevel.getValue());
dimension.setBorderSize((Integer) spinnerBorderSize.getValue() / 128);
dimension.setBedrockWall(checkBoxBedrockWall.isSelected());
long previousSeed = dimension.getMinecraftSeed();
long newSeed = ((Number) spinnerMinecraftSeed.getValue()).longValue();
if (newSeed != previousSeed) {
dimension.setMinecraftSeed(newSeed);
}
dimension.setBottomless(checkBoxBottomless.isSelected());
dimension.setCoverSteepTerrain(checkBoxCoverSteepTerrain.isSelected());
dimension.setCeilingHeight((Integer) spinnerCeilingHeight.getValue());
// Minecraft world border
World2 world = dimension.getWorld();
if (world != null) {
World2.BorderSettings borderSettings = world.getBorderSettings();
borderSettings.setCentreX((Integer) spinnerMcBorderCentreX.getValue());
borderSettings.setCentreY((Integer) spinnerMcBorderCentreY.getValue());
borderSettings.setSize((Integer) spinnerMcBorderSize.getValue());
// borderSettings.setSafeZone((Integer) spinnerMcBorderBuffer.getValue());
// borderSettings.setDamagePerBlock((Float) spinnerMcBorderDamage.getValue());
// borderSettings.setWarningTime((Integer) spinnerMcBorderWarningTime.getValue());
// borderSettings.setWarningBlocks((Integer) spinnerMcBorderWarningDistance.getValue());
}
// caverns
CavernsSettings cavernsSettings = (CavernsSettings) dimension.getLayerSettings(Caverns.INSTANCE);
if (cavernsSettings == null) {
cavernsSettings = new CavernsSettings();
}
if (checkBoxCavernsEverywhere.isSelected()) {
int cavernsEverywhereLevel = sliderCavernsEverywhereLevel.getValue();
cavernsSettings.setCavernsEverywhereLevel(cavernsEverywhereLevel);
} else {
cavernsSettings.setCavernsEverywhereLevel(0);
}
if (checkBoxFloodCaverns.isSelected()) {
cavernsSettings.setWaterLevel((Integer) spinnerCavernsFloodLevel.getValue());
} else {
cavernsSettings.setWaterLevel(0);
}
cavernsSettings.setFloodWithLava(checkBoxCavernsFloodWithLava.isSelected());
cavernsSettings.setSurfaceBreaking(checkBoxCavernsBreakSurface.isSelected());
cavernsSettings.setLeaveWater(!checkBoxCavernsRemoveWater.isSelected());
cavernsSettings.setMinimumLevel((Integer) spinnerCavernsMinLevel.getValue());
int cavernsMaxLevel = (Integer) spinnerCavernsMaxLevel.getValue();
cavernsSettings.setMaximumLevel((cavernsMaxLevel >= maxHeight) ? Integer.MAX_VALUE : cavernsMaxLevel);
dimension.setLayerSettings(Caverns.INSTANCE, cavernsSettings);
// chasms
ChasmsSettings chasmsSettings = (ChasmsSettings) dimension.getLayerSettings(Chasms.INSTANCE);
if (chasmsSettings == null) {
chasmsSettings = new ChasmsSettings();
}
if (checkBoxChasmsEverywhere.isSelected()) {
int chasmsEverywhereLevel = sliderChasmsEverywhereLevel.getValue();
chasmsSettings.setChasmsEverywhereLevel(chasmsEverywhereLevel);
} else {
chasmsSettings.setChasmsEverywhereLevel(0);
}
chasmsSettings.setSurfaceBreaking(checkBoxChasmsBreakSurface.isSelected());
// Other settings copied from Caverns layer
if (checkBoxFloodCaverns.isSelected()) {
chasmsSettings.setWaterLevel((Integer) spinnerCavernsFloodLevel.getValue());
} else {
chasmsSettings.setWaterLevel(0);
}
chasmsSettings.setFloodWithLava(checkBoxCavernsFloodWithLava.isSelected());
chasmsSettings.setLeaveWater(!checkBoxCavernsRemoveWater.isSelected());
chasmsSettings.setMinimumLevel((Integer) spinnerChasmsMinLevel.getValue());
chasmsSettings.setMaximumLevel((Integer) spinnerChasmsMaxLevel.getValue());
dimension.setLayerSettings(Chasms.INSTANCE, chasmsSettings);
// populate
dimension.setPopulate(checkBoxPopulate.isSelected());
// deciduous
TreeLayerSettings<DeciduousForest> deciduousSettings = (TreeLayerSettings<DeciduousForest>) dimension.getLayerSettings(DeciduousForest.INSTANCE);
if (deciduousSettings == null) {
deciduousSettings = new TreeLayerSettings<>(DeciduousForest.INSTANCE);
}
if (checkBoxDeciduousEverywhere.isSelected()) {
int minimumLevel = sliderDeciduousLevel.getValue();
deciduousSettings.setMinimumLevel(minimumLevel);
} else {
deciduousSettings.setMinimumLevel(0);
}
dimension.setLayerSettings(DeciduousForest.INSTANCE, deciduousSettings);
// pine
TreeLayerSettings<PineForest> pineSettings = (TreeLayerSettings<PineForest>) dimension.getLayerSettings(PineForest.INSTANCE);
if (pineSettings == null) {
pineSettings = new TreeLayerSettings<>(PineForest.INSTANCE);
}
if (checkBoxPineEverywhere.isSelected()) {
int minimumLevel = sliderPineLevel.getValue();
pineSettings.setMinimumLevel(minimumLevel);
} else {
pineSettings.setMinimumLevel(0);
}
dimension.setLayerSettings(PineForest.INSTANCE, pineSettings);
// jungle
TreeLayerSettings<Jungle> jungleSettings = (TreeLayerSettings<Jungle>) dimension.getLayerSettings(Jungle.INSTANCE);
if (jungleSettings == null) {
jungleSettings = new TreeLayerSettings<>(Jungle.INSTANCE);
}
if (checkBoxJungleEverywhere.isSelected()) {
int minimumLevel = sliderJungleLevel.getValue();
jungleSettings.setMinimumLevel(minimumLevel);
} else {
jungleSettings.setMinimumLevel(0);
}
dimension.setLayerSettings(Jungle.INSTANCE, jungleSettings);
// swampland
TreeLayerSettings<SwampLand> swampLandSettings = (TreeLayerSettings<SwampLand>) dimension.getLayerSettings(SwampLand.INSTANCE);
if (swampLandSettings == null) {
swampLandSettings = new TreeLayerSettings<>(SwampLand.INSTANCE);
}
if (checkBoxSwamplandEverywhere.isSelected()) {
int minimumLevel = jSlider6.getValue();
swampLandSettings.setMinimumLevel(minimumLevel);
} else {
swampLandSettings.setMinimumLevel(0);
}
dimension.setLayerSettings(SwampLand.INSTANCE, swampLandSettings);
// frost
FrostSettings frostSettings = (FrostSettings) dimension.getLayerSettings(Frost.INSTANCE);
if (frostSettings == null) {
frostSettings = new FrostSettings();
}
frostSettings.setFrostEverywhere(checkBoxFrostEverywhere.isSelected());
if ((!checkBoxSmoothSnow.isSelected()) || (frostSettings.getMode() != 3)) {
frostSettings.setMode(checkBoxSmoothSnow.isSelected() ? 2 : 0);
}
frostSettings.setSnowUnderTrees(checkBoxSnowUnderTrees.isSelected());
dimension.setLayerSettings(Frost.INSTANCE, frostSettings);
// resources
ResourcesExporterSettings resourcesSettings = (ResourcesExporterSettings) dimension.getLayerSettings(Resources.INSTANCE);
if (resourcesSettings == null) {
resourcesSettings = new ResourcesExporterSettings(dimension.getMaxHeight());
}
if (jCheckBox8.isSelected()) {
int minimumLevel = jSlider4.getValue();
resourcesSettings.setMinimumLevel(minimumLevel);
} else {
resourcesSettings.setMinimumLevel(0);
}
resourcesSettings.setChance(BLK_GOLD_ORE, (Integer) spinnerGoldChance.getValue());
resourcesSettings.setMinLevel(BLK_GOLD_ORE, (Integer) spinnerGoldMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_GOLD_ORE, (Integer) spinnerGoldMaxLevel.getValue());
resourcesSettings.setChance(BLK_IRON_ORE, (Integer) spinnerIronChance.getValue());
resourcesSettings.setMinLevel(BLK_IRON_ORE, (Integer) spinnerIronMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_IRON_ORE, (Integer) spinnerIronMaxLevel.getValue());
resourcesSettings.setChance(BLK_COAL, (Integer) spinnerCoalChance.getValue());
resourcesSettings.setMinLevel(BLK_COAL, (Integer) spinnerCoalMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_COAL, (Integer) spinnerCoalMaxLevel.getValue());
resourcesSettings.setChance(BLK_LAPIS_LAZULI_ORE, (Integer) spinnerLapisChance.getValue());
resourcesSettings.setMinLevel(BLK_LAPIS_LAZULI_ORE, (Integer) spinnerLapisMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_LAPIS_LAZULI_ORE, (Integer) spinnerLapisMaxLevel.getValue());
resourcesSettings.setChance(BLK_DIAMOND_ORE, (Integer) spinnerDiamondChance.getValue());
resourcesSettings.setMinLevel(BLK_DIAMOND_ORE, (Integer) spinnerDiamondMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_DIAMOND_ORE, (Integer) spinnerDiamondMaxLevel.getValue());
resourcesSettings.setChance(BLK_REDSTONE_ORE, (Integer) spinnerRedstoneChance.getValue());
resourcesSettings.setMinLevel(BLK_REDSTONE_ORE, (Integer) spinnerRedstoneMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_REDSTONE_ORE, (Integer) spinnerRedstoneMaxLevel.getValue());
resourcesSettings.setChance(BLK_WATER, (Integer) spinnerWaterChance.getValue());
resourcesSettings.setMinLevel(BLK_WATER, (Integer) spinnerWaterMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_WATER, (Integer) spinnerWaterMaxLevel.getValue());
resourcesSettings.setChance(BLK_LAVA, (Integer) spinnerLavaChance.getValue());
resourcesSettings.setMinLevel(BLK_LAVA, (Integer) spinnerLavaMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_LAVA, (Integer) spinnerLavaMaxLevel.getValue());
resourcesSettings.setChance(BLK_DIRT, (Integer) spinnerDirtChance.getValue());
resourcesSettings.setMinLevel(BLK_DIRT, (Integer) spinnerDirtMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_DIRT, (Integer) spinnerDirtMaxLevel.getValue());
resourcesSettings.setChance(BLK_GRAVEL, (Integer) spinnerGravelChance.getValue());
resourcesSettings.setMinLevel(BLK_GRAVEL, (Integer) spinnerGravelMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_GRAVEL, (Integer) spinnerGravelMaxLevel.getValue());
resourcesSettings.setChance(BLK_EMERALD_ORE, (Integer) spinnerEmeraldChance.getValue());
resourcesSettings.setMinLevel(BLK_EMERALD_ORE, (Integer) spinnerEmeraldMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_EMERALD_ORE, (Integer) spinnerEmeraldMaxLevel.getValue());
resourcesSettings.setChance(BLK_QUARTZ_ORE, (Integer) spinnerQuartzChance.getValue());
resourcesSettings.setMinLevel(BLK_QUARTZ_ORE, (Integer) spinnerQuartzMinLevel.getValue());
resourcesSettings.setMaxLevel(BLK_QUARTZ_ORE, (Integer) spinnerQuartzMaxLevel.getValue());
dimension.setLayerSettings(Resources.INSTANCE, resourcesSettings);
// annotations
AnnotationsSettings annotationsSettings = (AnnotationsSettings) dimension.getLayerSettings(Annotations.INSTANCE);
if (annotationsSettings == null) {
annotationsSettings = new AnnotationsSettings();
}
annotationsSettings.setExport(checkBoxExportAnnotations.isSelected());
dimension.setLayerSettings(Annotations.INSTANCE, annotationsSettings);
// custom layers
if ((mode == Mode.EXPORT) && (!customLayersTableModel.isPristine())) {
customLayersTableModel.save();
dimension.setDirty(true);
}
return true;
}
Aggregations