ItemCustomSeed item = new ItemCustomSeed();
Stuff.seed = Optional.of(item);
GameRegistry.registerItem(item, "extrabiomes.seed", Reference.MOD_ID);
for (ItemCustomSeed.SeedType type : ItemCustomSeed.SeedType.values()) {
final Element seed_element;
final Element plant_element;
try {
seed_element = Element.valueOf("SEED_" + type.name());
plant_element = Element.valueOf("PLANT_" + type.name());
} catch (Exception e) {
LogHelper.warning("Missing element for seed " + type);
continue;
}
final ItemStack seed_item = new ItemStack(item, 1, type.meta);
seed_element.set(seed_item);
// and associate with our target block
if (plant_element != null && plant_element.isPresent()) {
final ItemStack plant_stack = plant_element.get();
final Block block = Block.getBlockFromItem(plant_stack.getItem());
if(block == Blocks.air) {
LogHelper.severe("Unable to get plant back from element for " + type);
} else if(block instanceof BlockCropBasic) {
type.cropType = (BlockCropBasic) block;