2011-03-14 18:08:57 -07:00
|
|
|
package org.bukkit;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import com.google.common.collect.Maps;
|
2019-03-13 17:42:57 +11:00
|
|
|
import org.jetbrains.annotations.Nullable;
|
2012-01-29 11:10:40 +01:00
|
|
|
|
2011-03-14 18:08:57 -07:00
|
|
|
/**
|
|
|
|
* Represents the different species of trees regardless of size.
|
|
|
|
*/
|
|
|
|
public enum TreeSpecies {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents the common tree species.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
GENERIC(0x0),
|
2011-03-14 18:08:57 -07:00
|
|
|
/**
|
|
|
|
* Represents the darker barked/leaved tree species.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
REDWOOD(0x1),
|
2011-03-14 18:08:57 -07:00
|
|
|
/**
|
|
|
|
* Represents birches.
|
|
|
|
*/
|
2012-03-05 12:29:09 -05:00
|
|
|
BIRCH(0x2),
|
|
|
|
/**
|
|
|
|
* Represents jungle trees.
|
|
|
|
*/
|
2013-11-13 17:53:49 -07:00
|
|
|
JUNGLE(0x3),
|
|
|
|
/**
|
|
|
|
* Represents acacia trees.
|
|
|
|
*/
|
|
|
|
ACACIA(0x4),
|
|
|
|
/**
|
|
|
|
* Represents dark oak trees.
|
|
|
|
*/
|
|
|
|
DARK_OAK(0x5),
|
|
|
|
;
|
2011-03-14 18:08:57 -07:00
|
|
|
|
|
|
|
private final byte data;
|
2012-01-29 11:10:40 +01:00
|
|
|
private final static Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap();
|
2011-03-14 18:08:57 -07:00
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
private TreeSpecies(final int data) {
|
|
|
|
this.data = (byte) data;
|
2011-03-14 18:08:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the associated data value representing this species
|
|
|
|
*
|
|
|
|
* @return A byte containing the data value of this tree species
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-03-14 18:08:57 -07:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-03-14 18:08:57 -07:00
|
|
|
public byte getData() {
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the TreeSpecies with the given data value
|
|
|
|
*
|
2012-01-29 11:10:40 +01:00
|
|
|
* @param data Data value to fetch
|
2013-12-15 01:07:43 -05:00
|
|
|
* @return The {@link TreeSpecies} representing the given value, or null
|
|
|
|
* if it doesn't exist
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-03-14 18:08:57 -07:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2019-03-13 17:42:57 +11:00
|
|
|
@Nullable
|
2011-03-14 18:08:57 -07:00
|
|
|
public static TreeSpecies getByData(final byte data) {
|
2012-01-29 11:10:40 +01:00
|
|
|
return BY_DATA.get(data);
|
2011-03-14 18:08:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
2012-01-29 11:10:40 +01:00
|
|
|
for (TreeSpecies species : values()) {
|
|
|
|
BY_DATA.put(species.data, species);
|
2011-03-14 18:08:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|