Represents various map environment types that a world may be
| 743 | * Represents various map environment types that a world may be |
| 744 | */ |
| 745 | public enum Environment { |
| 746 | /** |
| 747 | * Represents the "normal"/"surface world" map |
| 748 | */ |
| 749 | NORMAL(0), |
| 750 | /** |
| 751 | * Represents a nether based map ("hell") |
| 752 | */ |
| 753 | NETHER(-1), |
| 754 | /** |
| 755 | * Represents a sky-lands based map ("heaven") |
| 756 | */ |
| 757 | SKYLANDS(1); |
| 758 | |
| 759 | private final int id; |
| 760 | private static final Map<Integer, Environment> lookup = new HashMap<Integer, Environment>(); |
| 761 | |
| 762 | private Environment(int id) { |
| 763 | this.id = id; |
| 764 | } |
| 765 | |
| 766 | /** |
| 767 | * Gets the dimension ID of this environment |
| 768 | * |
| 769 | * @return dimension ID |
| 770 | */ |
| 771 | public int getId() { |
| 772 | return id; |
| 773 | } |
| 774 | |
| 775 | public static Environment getEnvironment(int id) { |
| 776 | return lookup.get(id); |
| 777 | } |
| 778 | |
| 779 | static { |
| 780 | for (Environment env : values()) { |
| 781 | lookup.put(env.getId(), env); |
| 782 | } |
| 783 | } |
| 784 | } |
| 785 | } |