Search in sources :

Example 1 with BiomeListCellRenderer

use of org.pepsoft.worldpainter.BiomeListCellRenderer 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

ArrayList (java.util.ArrayList)1 BiomeListCellRenderer (org.pepsoft.worldpainter.BiomeListCellRenderer)1 ColourScheme (org.pepsoft.worldpainter.ColourScheme)1 CustomBiome (org.pepsoft.worldpainter.biomeschemes.CustomBiome)1 CustomBiomeManager (org.pepsoft.worldpainter.biomeschemes.CustomBiomeManager)1 TerrainListCellRenderer (org.pepsoft.worldpainter.themes.TerrainListCellRenderer)1