001/*
002 * Trident - A Multithreaded Server Alternative
003 * Copyright 2014 The TridentSDK Team
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *    http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package net.tridentsdk.world.settings;
019
020import java.util.Collections;
021import java.util.EnumSet;
022import java.util.HashMap;
023import java.util.Map;
024
025/**
026 * The possible climate zones which divide the world
027 *
028 * @author The TridentSDK Team
029 * @since 0.3-alpha-DP
030 */
031public enum Biome {
032    OCEAN(0),
033    PLAINS(1),
034    DESERT(2),
035    EXTREME_HILLS(3),
036    FOREST(4),
037    TAIGA(5),
038    SWAMPLAND(6),
039    RIVER(7),
040    HELL(8),
041    THE_END(9),
042    /**
043     * @deprecated This biome exists only in code, and does not generate naturally
044     */
045    @Deprecated
046    FROZEN_OCEAN(10),
047    FROZEN_RIVER(11),
048    ICE_PLAINS(12),
049    MUSHROOM_ISLAND(14),
050    MUSHROOM_ISLAND_SHORE(15),
051    BEACH(16),
052    /**
053     * @deprecated This biome exists only in code, and does not generate naturally
054     */
055    @Deprecated
056    EXTREME_HILLS_EDGE(20),
057    JUNGLE(21),
058    JUNGLE_EDGE(23),
059    DEEP_OCEAN(24),
060    STONE_BEACH(25),
061    COLD_BEACH(26),
062    BIRCH_FOREST(27),
063    BIRCH_FOREST_HILLS(28),
064    ROOFED_FOREST(29),
065    COLD_TAIGA(30),
066    MEGA_TAIGA(32),
067    EXTREME_HILLS_PLUS(34),
068
069    SAVANNA(35),
070    SAVANNA_PLATEAU(36),
071    MESA(37),
072    MESA_PLATEAU_F(38),
073    MESA_PLATEAU(39),
074
075    SUNFLOWER_PLAINS(129),
076    DESERT_M(130),
077    EXTREME_HILLS_M(131),
078    FLOWER_FOREST(132),
079    TAIGA_M(133),
080    SWAMPLAND_M(134),
081    ICE_PLAINS_SPIKES(140),
082    JUNGLE_M(149),
083    JUNGLE_EDGE_M(151),
084    BIRCH_FOREST_M(155),
085    BIRCH_FOREST_HILLS_M(156),
086    ROOFED_FOREST_M(158),
087    COLD_TAIGA_M(158),
088    MEGA_SPRUCE_TAIGA(160),
089    REDWOOD_TAIGA_HILLS_M(161),
090    EXTREME_HILLS_PLUS_M(162),
091
092    SAVANNA_M(163),
093    SAVANNA_PLATEAU_M(164),
094    MESA_BRYCE(165),
095    MESA_PLATEAU_F_M(166),
096    MESA_PLATEAU_M(167);
097
098    private final byte id;
099
100    private static final Map<Byte, Biome> map;
101
102    static {
103        HashMap<Byte, Biome> temp = new HashMap<>();
104        for (Biome biome : EnumSet.allOf(Biome.class)) {
105            temp.put(biome.id, biome);
106        }
107        map = Collections.unmodifiableMap(temp);
108    }
109
110    Biome(int id) {
111        this.id = (byte) id;
112    }
113
114    public int id() {
115        return id;
116    }
117
118    public static Biome fromId(byte id) {
119        return map.get(id);
120    }
121
122    public static Biome fromId(int id) {
123        return fromId((byte) id);
124    }
125}