001 package org.bukkit; 002 003 import java.util.Map; 004 005 import com.google.common.collect.Maps; 006 007 /** 008 * Represents the different species of trees regardless of size. 009 */ 010 public enum TreeSpecies { 011 012 /** 013 * Represents the common tree species. 014 */ 015 GENERIC(0x0), 016 /** 017 * Represents the darker barked/leaved tree species. 018 */ 019 REDWOOD(0x1), 020 /** 021 * Represents birches. 022 */ 023 BIRCH(0x2), 024 /** 025 * Represents jungle trees. 026 */ 027 JUNGLE(0x3), 028 /** 029 * Represents acacia trees. 030 */ 031 ACACIA(0x4), 032 /** 033 * Represents dark oak trees. 034 */ 035 DARK_OAK(0x5), 036 ; 037 038 private final byte data; 039 private final static Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap(); 040 041 private TreeSpecies(final int data) { 042 this.data = (byte) data; 043 } 044 045 /** 046 * Gets the associated data value representing this species 047 * 048 * @return A byte containing the data value of this tree species 049 * @deprecated Magic value 050 */ 051 @Deprecated 052 public byte getData() { 053 return data; 054 } 055 056 /** 057 * Gets the TreeSpecies with the given data value 058 * 059 * @param data Data value to fetch 060 * @return The {@link TreeSpecies} representing the given value, or null 061 * if it doesn't exist 062 * @deprecated Magic value 063 */ 064 @Deprecated 065 public static TreeSpecies getByData(final byte data) { 066 return BY_DATA.get(data); 067 } 068 069 static { 070 for (TreeSpecies species : values()) { 071 BY_DATA.put(species.data, species); 072 } 073 } 074 }