Search in sources :

Example 6 with CustomBiome

use of org.pepsoft.worldpainter.biomeschemes.CustomBiome in project WorldPainter by Captain-Chaos.

the class CombinedLayerEditor method setContext.

@Override
public void setContext(LayerEditorContext context) {
    super.setContext(context);
    CustomBiomeManager customBiomeManager = context.getCustomBiomeManager();
    ColourScheme colourScheme = context.getColourScheme();
    comboBoxTerrain.setRenderer(new TerrainListCellRenderer(colourScheme, "none"));
    comboBoxBiome.setRenderer(new BiomeListCellRenderer(colourScheme, customBiomeManager, "none"));
    List<Integer> allBiomes = new ArrayList<>();
    allBiomes.add(-1);
    for (int i = 0; i < Minecraft1_7Biomes.BIOME_NAMES.length; i++) {
        if (Minecraft1_7Biomes.BIOME_NAMES[i] != null) {
            allBiomes.add(i);
        }
    }
    List<CustomBiome> customBiomes = customBiomeManager.getCustomBiomes();
    if (customBiomes != null) {
        allBiomes.addAll(customBiomes.stream().map(CustomBiome::getId).collect(Collectors.toList()));
    }
    comboBoxBiome.setModel(new DefaultComboBoxModel(allBiomes.toArray()));
    allLayers = context.getAllLayers();
}
Also used : ColourScheme(org.pepsoft.worldpainter.ColourScheme) CustomBiome(org.pepsoft.worldpainter.biomeschemes.CustomBiome) ArrayList(java.util.ArrayList) CustomBiomeManager(org.pepsoft.worldpainter.biomeschemes.CustomBiomeManager) TerrainListCellRenderer(org.pepsoft.worldpainter.themes.TerrainListCellRenderer) BiomeListCellRenderer(org.pepsoft.worldpainter.BiomeListCellRenderer)

Aggregations

CustomBiome (org.pepsoft.worldpainter.biomeschemes.CustomBiome)6 ArrayList (java.util.ArrayList)2 CustomBiomeManager (org.pepsoft.worldpainter.biomeschemes.CustomBiomeManager)2 GroundCoverLayer (org.pepsoft.worldpainter.layers.groundcover.GroundCoverLayer)2 PlantLayer (org.pepsoft.worldpainter.layers.plants.PlantLayer)2 UndergroundPocketsLayer (org.pepsoft.worldpainter.layers.pockets.UndergroundPocketsLayer)2 TunnelLayer (org.pepsoft.worldpainter.layers.tunnel.TunnelLayer)2 java.awt (java.awt)1 ActionEvent (java.awt.event.ActionEvent)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 java.util (java.util)1 List (java.util.List)1 javax.swing (javax.swing)1 NumberEditor (javax.swing.JSpinner.NumberEditor)1 FileFilter (javax.swing.filechooser.FileFilter)1 TreePath (javax.swing.tree.TreePath)1 Constants (org.pepsoft.minecraft.Constants)1 IconUtils (org.pepsoft.util.IconUtils)1 ObservableBoolean (org.pepsoft.util.ObservableBoolean)1 OperationCancelled (org.pepsoft.util.ProgressReceiver.OperationCancelled)1