Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
CropState.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 growth states of crops
9  */
10 public enum CropState {
11 
12  /**
13  * State when first seeded
14  */
15  SEEDED(0x0),
16  /**
17  * First growth stage
18  */
19  GERMINATED(0x1),
20  /**
21  * Second growth stage
22  */
23  VERY_SMALL(0x2),
24  /**
25  * Third growth stage
26  */
27  SMALL(0x3),
28  /**
29  * Fourth growth stage
30  */
31  MEDIUM(0x4),
32  /**
33  * Fifth growth stage
34  */
35  TALL(0x5),
36  /**
37  * Almost ripe stage
38  */
39  VERY_TALL(0x6),
40  /**
41  * Ripe stage
42  */
43  RIPE(0x7);
44 
45  private final byte data;
46  private final static Map<Byte, CropState> BY_DATA = Maps.newHashMap();
47 
48  private CropState(final int data) {
49  this.data = (byte) data;
50  }
51 
52  /**
53  * Gets the associated data value representing this growth state
54  *
55  * @return A byte containing the data value of this growth state
56  * @deprecated Magic value
57  */
58  @Deprecated
59  public byte getData() {
60  return data;
61  }
62 
63  /**
64  * Gets the CropState with the given data value
65  *
66  * @param data Data value to fetch
67  * @return The {@link CropState} representing the given value, or null if
68  * it doesn't exist
69  * @deprecated Magic value
70  */
71  @Deprecated
72  public static CropState getByData(final byte data) {
73  return BY_DATA.get(data);
74  }
75 
76  static {
77  for (CropState cropState : values()) {
78  BY_DATA.put(cropState.getData(), cropState);
79  }
80  }
81 }
static CropState getByData(final byte data)
Definition: CropState.java:72