Represents the different growth states of crops
| 7 | * Represents the different growth states of crops |
| 8 | */ |
| 9 | public enum CropState { |
| 10 | |
| 11 | /** |
| 12 | * State when first seeded |
| 13 | */ |
| 14 | SEEDED((byte) 0x0), |
| 15 | /** |
| 16 | * First growth stage |
| 17 | */ |
| 18 | GERMINATED((byte) 0x1), |
| 19 | /** |
| 20 | * Second growth stage |
| 21 | */ |
| 22 | VERY_SMALL((byte) 0x2), |
| 23 | /** |
| 24 | * Third growth stage |
| 25 | */ |
| 26 | SMALL((byte) 0x3), |
| 27 | /** |
| 28 | * Fourth growth stage |
| 29 | */ |
| 30 | MEDIUM((byte) 0x4), |
| 31 | /** |
| 32 | * Fifth growth stage |
| 33 | */ |
| 34 | TALL((byte) 0x5), |
| 35 | /** |
| 36 | * Almost ripe stage |
| 37 | */ |
| 38 | VERY_TALL((byte) 0x6), |
| 39 | /** |
| 40 | * Ripe stage |
| 41 | */ |
| 42 | RIPE((byte) 0x7); |
| 43 | |
| 44 | private final byte data; |
| 45 | private final static Map<Byte, CropState> states = new HashMap<Byte, CropState>(); |
| 46 | |
| 47 | private CropState(final byte data) { |
| 48 | this.data = data; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Gets the associated data value representing this growth state |
| 53 | * |
| 54 | * @return A byte containing the data value of this growth state |
| 55 | */ |
| 56 | public byte getData() { |
| 57 | return data; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Gets the CropState with the given data value |
| 62 | * |
| 63 | * @param data |
| 64 | * Data value to fetch |
| 65 | * @return The {@link CropState} representing the given value, or null if |
| 66 | * it doesn't exist |