Created
September 10, 2018 17:44
-
-
Save Crypnotic/787e1abd191a96c36d822a2a551eb239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequiredArgsConstructor | |
public static enum CropSpec { | |
BEETROOT(Material.BEETROOT_BLOCK, Material.BEETROOT, Material.BEETROOT_SEEDS), | |
CARROT(Material.CARROT, Material.CARROT_ITEM, Material.CARROT_ITEM), | |
NETHER_WARTS(Material.NETHER_WART_BLOCK, Material.NETHER_WARTS, Material.NETHER_WARTS), | |
POTATO(Material.POTATO, Material.POTATO_ITEM, Material.POTATO_ITEM), | |
WHEAT(Material.CROPS, Material.WHEAT, Material.SEEDS); | |
@Getter | |
private final Material block; | |
@Getter | |
private final Material product; | |
@Getter | |
private final Material seed; | |
public static boolean isCrop(Material material) { | |
for (CropSpec type : values()) { | |
if (type.getBlock() == material) { | |
return true; | |
} | |
} | |
return false; | |
} | |
public static CropSpec getCropSpec(Material material) { | |
for (CropSpec type : values()) { | |
if (type.getBlock() == material) { | |
return type; | |
} | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment