Skip to content

Commit

Permalink
Attempt lazy fix for #174 (#178)
Browse files Browse the repository at this point in the history
I tested, and it worked!
  • Loading branch information
The-Fireplace authored and Kenkron committed May 5, 2018
1 parent 88a5c91 commit 4586011
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/main/java/hunternif/mc/atlas/core/BiomeDetectorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;

import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.*;

/**
* Detects the 256 vanilla biomes, water pools and lava pools.
Expand Down Expand Up @@ -100,16 +97,19 @@ public int getBiomeID(Chunk chunk) {
}
}

Map.Entry<Integer, Integer> meanBiome = Collections.max(biomeOccurrences.entrySet(), Comparator.comparingInt(Map.Entry::getValue));
int meanBiomeId = meanBiome.getKey();
int meanBiomeOccurrences = meanBiome.getValue();
try {
Map.Entry<Integer, Integer> meanBiome = Collections.max(biomeOccurrences.entrySet(), Comparator.comparingInt(Map.Entry::getValue));
int meanBiomeId = meanBiome.getKey();
int meanBiomeOccurrences = meanBiome.getValue();

// The following important pseudo-biomes don't have IDs:
if (meanBiomeOccurrences < lavaOccurrences) {
return ExtTileIdMap.instance().getPseudoBiomeID(ExtTileIdMap.TILE_LAVA);
}

// The following important pseudo-biomes don't have IDs:
if (meanBiomeOccurrences < lavaOccurrences) {
return ExtTileIdMap.instance().getPseudoBiomeID(ExtTileIdMap.TILE_LAVA);
return meanBiomeId;
} catch(NoSuchElementException e){
return Biome.getIdForBiome(Biomes.DEFAULT);
}

return meanBiomeId;
}
}

0 comments on commit 4586011

Please sign in to comment.