Skip to content

Commit

Permalink
Merge pull request toolbox4minecraft#167 from moulins/better-biome-types
Browse files Browse the repository at this point in the history
Add better naming for BiomeType class.
  • Loading branch information
stefandollase authored Jul 3, 2016
2 parents 749c34b + 559f346 commit b91964f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 69 deletions.
82 changes: 41 additions & 41 deletions src/main/java/amidst/mojangapi/world/biome/Biome.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,46 +49,46 @@ private void findNextValid() {
private static final Map<String, Biome> biomeMap = new HashMap<String, Biome>();
private static final Biome[] biomes = new Biome[256];

public static final Biome ocean = new Biome("Ocean", 0, BiomeColor.from( 0, 0, 112), BiomeType.TYPE_C);
public static final Biome plains = new Biome("Plains", 1, BiomeColor.from(141, 179, 96), BiomeType.TYPE_A);
public static final Biome desert = new Biome("Desert", 2, BiomeColor.from(250, 148, 24), BiomeType.TYPE_E);
public static final Biome extremeHills = new Biome("Extreme Hills", 3, BiomeColor.from( 96, 96, 96), BiomeType.TYPE_I);
public static final Biome forest = new Biome("Forest", 4, BiomeColor.from( 5, 102, 33), BiomeType.TYPE_A);
public static final Biome taiga = new Biome("Taiga", 5, BiomeColor.from( 11, 102, 89), BiomeType.TYPE_F);
public static final Biome swampland = new Biome("Swampland", 6, BiomeColor.from( 7, 249, 178), BiomeType.TYPE_M);
public static final Biome river = new Biome("River", 7, BiomeColor.from( 0, 0, 255), BiomeType.TYPE_B);
public static final Biome hell = new Biome("Hell", 8, BiomeColor.from(255, 0, 0), BiomeType.TYPE_A);
public static final Biome theEnd = new Biome("The End", 9, BiomeColor.from(128, 128, 255), BiomeType.TYPE_A);
public static final Biome frozenOcean = new Biome("Frozen Ocean", 10, BiomeColor.from(144, 144, 160), BiomeType.TYPE_C);
public static final Biome frozenRiver = new Biome("Frozen River", 11, BiomeColor.from(160, 160, 255), BiomeType.TYPE_B);
public static final Biome icePlains = new Biome("Ice Plains", 12, BiomeColor.from(255, 255, 255), BiomeType.TYPE_E);
public static final Biome iceMountains = new Biome("Ice Mountains", 13, BiomeColor.from(160, 160, 160), BiomeType.TYPE_G);
public static final Biome mushroomIsland = new Biome("Mushroom Island", 14, BiomeColor.from(255, 0, 255), BiomeType.TYPE_L);
public static final Biome mushroomIslandShore = new Biome("Mushroom Island Shore", 15, BiomeColor.from(160, 0, 255), BiomeType.TYPE_J);
public static final Biome beach = new Biome("Beach", 16, BiomeColor.from(250, 222, 85), BiomeType.TYPE_J);
public static final Biome desertHills = new Biome("Desert Hills", 17, BiomeColor.from(210, 95, 18), BiomeType.TYPE_G);
public static final Biome forestHills = new Biome("Forest Hills", 18, BiomeColor.from( 34, 85, 28), BiomeType.TYPE_G);
public static final Biome taigaHills = new Biome("Taiga Hills", 19, BiomeColor.from( 22, 57, 51), BiomeType.TYPE_G);
public static final Biome extremeHillsEdge = new Biome("Extreme Hills Edge", 20, BiomeColor.from(114, 120, 154), BiomeType.TYPE_I.getExtreme());
public static final Biome jungle = new Biome("Jungle", 21, BiomeColor.from( 83, 123, 9), BiomeType.TYPE_A);
public static final Biome jungleHills = new Biome("Jungle Hills", 22, BiomeColor.from( 44, 66, 5), BiomeType.TYPE_G);
public static final Biome jungleEdge = new Biome("Jungle Edge", 23, BiomeColor.from( 98, 139, 23), BiomeType.TYPE_A);
public static final Biome deepOcean = new Biome("Deep Ocean", 24, BiomeColor.from( 0, 0, 48), BiomeType.TYPE_D);
public static final Biome stoneBeach = new Biome("Stone Beach", 25, BiomeColor.from(162, 162, 132), BiomeType.TYPE_K);
public static final Biome coldBeach = new Biome("Cold Beach", 26, BiomeColor.from(250, 240, 192), BiomeType.TYPE_J);
public static final Biome birchForest = new Biome("Birch Forest", 27, BiomeColor.from( 48, 116, 68), BiomeType.TYPE_A);
public static final Biome birchForestHills = new Biome("Birch Forest Hills", 28, BiomeColor.from( 31, 95, 50), BiomeType.TYPE_G);
public static final Biome roofedForest = new Biome("Roofed Forest", 29, BiomeColor.from( 64, 81, 26), BiomeType.TYPE_A);
public static final Biome coldTaiga = new Biome("Cold Taiga", 30, BiomeColor.from( 49, 85, 74), BiomeType.TYPE_F);
public static final Biome coldTaigaHills = new Biome("Cold Taiga Hills", 31, BiomeColor.from( 36, 63, 54), BiomeType.TYPE_G);
public static final Biome megaTaiga = new Biome("Mega Taiga", 32, BiomeColor.from( 89, 102, 81), BiomeType.TYPE_F);
public static final Biome megaTaigaHills = new Biome("Mega Taiga Hills", 33, BiomeColor.from( 69, 79, 62), BiomeType.TYPE_G);
public static final Biome extremeHillsPlus = new Biome("Extreme Hills+", 34, BiomeColor.from( 80, 112, 80), BiomeType.TYPE_I);
public static final Biome savanna = new Biome("Savanna", 35, BiomeColor.from(189, 178, 95), BiomeType.TYPE_E);
public static final Biome savannaPlateau = new Biome("Savanna Plateau", 36, BiomeColor.from(167, 157, 100), BiomeType.TYPE_H);
public static final Biome mesa = new Biome("Mesa", 37, BiomeColor.from(217, 69, 21), BiomeType.TYPE_A);
public static final Biome mesaPlateauF = new Biome("Mesa Plateau F", 38, BiomeColor.from(176, 151, 101), BiomeType.TYPE_H);
public static final Biome mesaPlateau = new Biome("Mesa Plateau", 39, BiomeColor.from(202, 140, 101), BiomeType.TYPE_H);
public static final Biome ocean = new Biome("Ocean", 0, BiomeColor.from( 0, 0, 112), BiomeType.OCEAN);
public static final Biome plains = new Biome("Plains", 1, BiomeColor.from(141, 179, 96), BiomeType.PLAINS);
public static final Biome desert = new Biome("Desert", 2, BiomeColor.from(250, 148, 24), BiomeType.PLAINS_FLAT);
public static final Biome extremeHills = new Biome("Extreme Hills", 3, BiomeColor.from( 96, 96, 96), BiomeType.MOUNTAINS);
public static final Biome forest = new Biome("Forest", 4, BiomeColor.from( 5, 102, 33), BiomeType.PLAINS);
public static final Biome taiga = new Biome("Taiga", 5, BiomeColor.from( 11, 102, 89), BiomeType.PLAINS_TAIGA);
public static final Biome swampland = new Biome("Swampland", 6, BiomeColor.from( 7, 249, 178), BiomeType.SWAMPLAND);
public static final Biome river = new Biome("River", 7, BiomeColor.from( 0, 0, 255), BiomeType.RIVER);
public static final Biome hell = new Biome("Hell", 8, BiomeColor.from(255, 0, 0), BiomeType.PLAINS);
public static final Biome theEnd = new Biome("The End", 9, BiomeColor.from(128, 128, 255), BiomeType.PLAINS);
public static final Biome frozenOcean = new Biome("Frozen Ocean", 10, BiomeColor.from(144, 144, 160), BiomeType.OCEAN);
public static final Biome frozenRiver = new Biome("Frozen River", 11, BiomeColor.from(160, 160, 255), BiomeType.RIVER);
public static final Biome icePlains = new Biome("Ice Plains", 12, BiomeColor.from(255, 255, 255), BiomeType.PLAINS_FLAT);
public static final Biome iceMountains = new Biome("Ice Mountains", 13, BiomeColor.from(160, 160, 160), BiomeType.HILLS);
public static final Biome mushroomIsland = new Biome("Mushroom Island", 14, BiomeColor.from(255, 0, 255), BiomeType.ISLAND);
public static final Biome mushroomIslandShore = new Biome("Mushroom Island Shore", 15, BiomeColor.from(160, 0, 255), BiomeType.BEACH);
public static final Biome beach = new Biome("Beach", 16, BiomeColor.from(250, 222, 85), BiomeType.BEACH);
public static final Biome desertHills = new Biome("Desert Hills", 17, BiomeColor.from(210, 95, 18), BiomeType.HILLS);
public static final Biome forestHills = new Biome("Forest Hills", 18, BiomeColor.from( 34, 85, 28), BiomeType.HILLS);
public static final Biome taigaHills = new Biome("Taiga Hills", 19, BiomeColor.from( 22, 57, 51), BiomeType.HILLS);
public static final Biome extremeHillsEdge = new Biome("Extreme Hills Edge", 20, BiomeColor.from(114, 120, 154), BiomeType.MOUNTAINS.weaken());
public static final Biome jungle = new Biome("Jungle", 21, BiomeColor.from( 83, 123, 9), BiomeType.PLAINS);
public static final Biome jungleHills = new Biome("Jungle Hills", 22, BiomeColor.from( 44, 66, 5), BiomeType.HILLS);
public static final Biome jungleEdge = new Biome("Jungle Edge", 23, BiomeColor.from( 98, 139, 23), BiomeType.PLAINS);
public static final Biome deepOcean = new Biome("Deep Ocean", 24, BiomeColor.from( 0, 0, 48), BiomeType.DEEP_OCEAN);
public static final Biome stoneBeach = new Biome("Stone Beach", 25, BiomeColor.from(162, 162, 132), BiomeType.BEACH_CLIFFS);
public static final Biome coldBeach = new Biome("Cold Beach", 26, BiomeColor.from(250, 240, 192), BiomeType.BEACH);
public static final Biome birchForest = new Biome("Birch Forest", 27, BiomeColor.from( 48, 116, 68), BiomeType.PLAINS);
public static final Biome birchForestHills = new Biome("Birch Forest Hills", 28, BiomeColor.from( 31, 95, 50), BiomeType.HILLS);
public static final Biome roofedForest = new Biome("Roofed Forest", 29, BiomeColor.from( 64, 81, 26), BiomeType.PLAINS);
public static final Biome coldTaiga = new Biome("Cold Taiga", 30, BiomeColor.from( 49, 85, 74), BiomeType.PLAINS_TAIGA);
public static final Biome coldTaigaHills = new Biome("Cold Taiga Hills", 31, BiomeColor.from( 36, 63, 54), BiomeType.HILLS);
public static final Biome megaTaiga = new Biome("Mega Taiga", 32, BiomeColor.from( 89, 102, 81), BiomeType.PLAINS_TAIGA);
public static final Biome megaTaigaHills = new Biome("Mega Taiga Hills", 33, BiomeColor.from( 69, 79, 62), BiomeType.HILLS);
public static final Biome extremeHillsPlus = new Biome("Extreme Hills+", 34, BiomeColor.from( 80, 112, 80), BiomeType.MOUNTAINS);
public static final Biome savanna = new Biome("Savanna", 35, BiomeColor.from(189, 178, 95), BiomeType.PLAINS_FLAT);
public static final Biome savannaPlateau = new Biome("Savanna Plateau", 36, BiomeColor.from(167, 157, 100), BiomeType.PLATEAU);
public static final Biome mesa = new Biome("Mesa", 37, BiomeColor.from(217, 69, 21), BiomeType.PLAINS);
public static final Biome mesaPlateauF = new Biome("Mesa Plateau F", 38, BiomeColor.from(176, 151, 101), BiomeType.PLATEAU);
public static final Biome mesaPlateau = new Biome("Mesa Plateau", 39, BiomeColor.from(202, 140, 101), BiomeType.PLATEAU);

public static final Biome oceanM = new Biome("Ocean M", 128, BiomeColor.from( 0, 0, 112));
public static final Biome sunflowerPlains = new Biome("Sunflower Plains", 129, BiomeColor.from(141, 179, 96));
Expand Down Expand Up @@ -172,7 +172,7 @@ public static int compareByIndex(String name1, String name2) {
private final BiomeType type;

public Biome(String name, int index, BiomeColor defaultColor) {
this(name, index, defaultColor.createLightenedBiomeColor(), biomes[index - 128].type.getRare());
this(name, index, defaultColor.createLightenedBiomeColor(), biomes[index - 128].type.strengthen());
}

public Biome(String name, int index, BiomeColor defaultColor, BiomeType type) {
Expand Down
53 changes: 26 additions & 27 deletions src/main/java/amidst/mojangapi/world/biome/BiomeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,45 @@

import amidst.documentation.Immutable;

// TODO: Rename once we figure out what this actually is!
@Immutable
public class BiomeType {
// @formatter:off
public static final BiomeType TYPE_A = new BiomeType( 0.1F, 0.2F);
public static final BiomeType TYPE_B = new BiomeType(-0.5F, 0.0F);
public static final BiomeType TYPE_C = new BiomeType(-1.0F, 0.1F);
public static final BiomeType TYPE_D = new BiomeType(-1.8F, 0.1F);
public static final BiomeType TYPE_E = new BiomeType( 0.125F, 0.05F);
public static final BiomeType TYPE_F = new BiomeType( 0.2F, 0.2F);
public static final BiomeType TYPE_G = new BiomeType( 0.45F, 0.3F);
public static final BiomeType TYPE_H = new BiomeType( 1.5F, 0.025F);
public static final BiomeType TYPE_I = new BiomeType( 1.0F, 0.5F);
public static final BiomeType TYPE_J = new BiomeType( 0.0F, 0.025F);
public static final BiomeType TYPE_K = new BiomeType( 0.1F, 0.8F);
public static final BiomeType TYPE_L = new BiomeType( 0.2F, 0.3F);
public static final BiomeType TYPE_M = new BiomeType(-0.2F, 0.1F);
public static final BiomeType PLAINS = new BiomeType( 0.1F, 0.2F);
public static final BiomeType RIVER = new BiomeType(-0.5F, 0.0F);
public static final BiomeType OCEAN = new BiomeType(-1.0F, 0.1F);
public static final BiomeType DEEP_OCEAN = new BiomeType(-1.8F, 0.1F);
public static final BiomeType PLAINS_FLAT = new BiomeType( 0.125F, 0.05F);
public static final BiomeType PLAINS_TAIGA = new BiomeType( 0.2F, 0.2F);
public static final BiomeType HILLS = new BiomeType( 0.45F, 0.3F);
public static final BiomeType PLATEAU = new BiomeType( 1.5F, 0.025F);
public static final BiomeType MOUNTAINS = new BiomeType( 1.0F, 0.5F);
public static final BiomeType BEACH = new BiomeType( 0.0F, 0.025F);
public static final BiomeType BEACH_CLIFFS = new BiomeType( 0.1F, 0.8F);
public static final BiomeType ISLAND = new BiomeType( 0.2F, 0.3F);
public static final BiomeType SWAMPLAND = new BiomeType(-0.2F, 0.1F);
// @formatter:on

private final float value1;
private final float value2;
private final float biomeDepth;
private final float biomeFactor;

public BiomeType(float value1, float value2) {
this.value1 = value1;
this.value2 = value2;
public BiomeType(float biomeDepth, float biomeFactor) {
this.biomeDepth = biomeDepth;
this.biomeFactor = biomeFactor;
}

public BiomeType getExtreme() {
return new BiomeType(value1 * 0.8F, value2 * 0.6F);
public BiomeType weaken() {
return new BiomeType(biomeDepth * 0.8F, biomeFactor * 0.6F);
}

public BiomeType getRare() {
return new BiomeType(value1 + 0.1F, value2 + 0.2F);
public BiomeType strengthen() {
return new BiomeType(biomeDepth + 0.1F, biomeFactor + 0.2F);
}

public float getValue1() {
return value1;
public float getBiomeDepth() {
return biomeDepth;
}

public float getValue2() {
return value2;
public float getBiomeFactor() {
return biomeFactor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private DefaultVersionFeatures() {
private static List<Biome> getValidBiomesForStrongholdSinceV13w36a() {
List<Biome> result = new ArrayList<Biome>();
for (Biome biome : Biome.allBiomes()) {
if (biome.getType().getValue1() > 0) {
if (biome.getType().getBiomeDepth() > 0) {
result.add(biome);
}
}
Expand Down

0 comments on commit b91964f

Please sign in to comment.