use of org.pepsoft.worldpainter.layers.exporters.TreesExporter.TreeLayerSettings 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.TreesExporter.TreeLayerSettings 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