2011-06-07 02:15:19 -04:00
|
|
|
package org.bukkit;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
2011-06-07 02:15:19 -04:00
|
|
|
/**
|
|
|
|
* Represents the different types of grass.
|
|
|
|
*/
|
|
|
|
public enum GrassSpecies {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents the dead looking grass.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
DEAD(0x0),
|
2011-06-07 02:15:19 -04:00
|
|
|
/**
|
|
|
|
* Represents the normal grass species.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
NORMAL(0x1),
|
2011-06-07 02:15:19 -04:00
|
|
|
/**
|
|
|
|
* Represents the fern-looking grass species.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
FERN_LIKE(0x2);
|
2011-06-07 02:15:19 -04:00
|
|
|
|
|
|
|
private final byte data;
|
2012-01-29 11:10:40 +01:00
|
|
|
private final static Map<Byte, GrassSpecies> BY_DATA = Maps.newHashMap();
|
2011-06-07 02:15:19 -04:00
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
private GrassSpecies(final int data) {
|
|
|
|
this.data = (byte) data;
|
2011-06-07 02:15:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the associated data value representing this species
|
|
|
|
*
|
|
|
|
* @return A byte containing the data value of this grass species
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-06-07 02:15:19 -04:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-06-07 02:15:19 -04:00
|
|
|
public byte getData() {
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the GrassSpecies with the given data value
|
|
|
|
*
|
|
|
|
* @param data
|
|
|
|
* Data value to fetch
|
|
|
|
* @return The {@link GrassSpecies} representing the given value, or null if
|
|
|
|
* it doesn't exist
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-06-07 02:15:19 -04:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-06-07 02:15:19 -04:00
|
|
|
public static GrassSpecies getByData(final byte data) {
|
2012-01-29 11:10:40 +01:00
|
|
|
return BY_DATA.get(data);
|
2011-06-07 02:15:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
2012-01-29 11:10:40 +01:00
|
|
|
for (GrassSpecies grassSpecies : values()) {
|
|
|
|
BY_DATA.put(grassSpecies.getData(), grassSpecies);
|
2011-06-07 02:15:19 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|