Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
GrassSpecies.java
1 package org.bukkit;
2 
3 import java.util.Map;
4 
5 import com.google.common.collect.Maps;
6 
7 /**
8  * Represents the different types of grass.
9  */
10 public enum GrassSpecies {
11 
12  /**
13  * Represents the dead looking grass.
14  */
15  DEAD(0x0),
16  /**
17  * Represents the normal grass species.
18  */
19  NORMAL(0x1),
20  /**
21  * Represents the fern-looking grass species.
22  */
23  FERN_LIKE(0x2);
24 
25  private final byte data;
26  private final static Map<Byte, GrassSpecies> BY_DATA = Maps.newHashMap();
27 
28  private GrassSpecies(final int data) {
29  this.data = (byte) data;
30  }
31 
32  /**
33  * Gets the associated data value representing this species
34  *
35  * @return A byte containing the data value of this grass species
36  * @deprecated Magic value
37  */
38  @Deprecated
39  public byte getData() {
40  return data;
41  }
42 
43  /**
44  * Gets the GrassSpecies with the given data value
45  *
46  * @param data Data value to fetch
47  * @return The {@link GrassSpecies} representing the given value, or null
48  * if it doesn't exist
49  * @deprecated Magic value
50  */
51  @Deprecated
52  public static GrassSpecies getByData(final byte data) {
53  return BY_DATA.get(data);
54  }
55 
56  static {
57  for (GrassSpecies grassSpecies : values()) {
58  BY_DATA.put(grassSpecies.getData(), grassSpecies);
59  }
60  }
61 }
static GrassSpecies getByData(final byte data)