/**
  * Indicates that some aspect of a custom biome (other than the ID, which is not allowed to
  * change) has changed.
  *
  * @param customBiome The custom biome that has been modified.
  */
 public void editCustomBiome(CustomBiome customBiome) {
   for (CustomBiome existingCustomBiome : customBiomes) {
     if (existingCustomBiome.getId() == customBiome.getId()) {
       for (CustomBiomeListener listener : listeners) {
         listener.customBiomeChanged(customBiome);
       }
       return;
     }
   }
   throw new IllegalArgumentException(
       "There is no custom biome installed with ID " + customBiome.getId());
 }
 /**
  * Removes a custom biome.
  *
  * @param customBiome The custom biome to remove.
  */
 public void removeCustomBiome(CustomBiome customBiome) {
   for (Iterator<CustomBiome> i = customBiomes.iterator(); i.hasNext(); ) {
     CustomBiome existingCustomBiome = i.next();
     if (existingCustomBiome.getId() == customBiome.getId()) {
       i.remove();
       for (CustomBiomeListener listener : listeners) {
         listener.customBiomeRemoved(customBiome);
       }
       return;
     }
   }
   throw new IllegalArgumentException(
       "There is no custom biome installed with ID " + customBiome.getId());
 }
 public boolean addCustomBiome(Window parent, CustomBiome customBiome) {
   if (isBiomePresent(customBiome.getId())) {
     JOptionPane.showMessageDialog(
         parent,
         "The specified ID ("
             + customBiome.getId()
             + ") is already a regular biome (named "
             + Minecraft1_7Biomes.BIOME_NAMES[customBiome.getId()]
             + ")",
         "ID Already In Use",
         JOptionPane.ERROR_MESSAGE);
     return false;
   }
   if (customBiomes == null) {
     customBiomes = new ArrayList<>();
   }
   for (CustomBiome existingCustomBiome : customBiomes) {
     if (existingCustomBiome.getId() == customBiome.getId()) {
       JOptionPane.showMessageDialog(
           parent,
           "You already configured a custom biome with that ID (named "
               + existingCustomBiome.getName()
               + ")",
           "ID Already In Use",
           JOptionPane.ERROR_MESSAGE);
       return false;
     }
   }
   customBiomes.add(customBiome);
   for (CustomBiomeListener listener : listeners) {
     listener.customBiomeAdded(customBiome);
   }
   return true;
 }
 public int getNextId() {
   if (customBiomes != null) {
     outer:
     for (int i = 40; i < 256; i++) {
       for (CustomBiome customBiome : customBiomes) {
         if (customBiome.getId() == i) {
           continue outer;
         }
       }
       if (isBiomePresent(i)) {
         continue;
       }
       return i;
     }
     return -1;
   } else {
     return 40;
   }
 }