public class VillageHandlerArboriculture implements IVillageTradeHandler {
@SuppressWarnings("unchecked")
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 8), PluginArboriculture.treeInterface.getMemberStack(
PluginArboriculture.treeInterface.getTree(villager.worldObj,
PluginArboriculture.treeInterface.templateAsGenome(PluginArboriculture.treeInterface.getRandomTemplate(random))),
EnumGermlingType.SAPLING.ordinal())));
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 2), ForestryItem.grafterProven.getItemStack()));
WoodType sells = WoodType.VALUES[random.nextInt(WoodType.VALUES.length)];
Block plankBlock;
int meta;
if(!sells.hasPlank) {
plankBlock = ForestryBlock.planks1.block();
meta = 0;
} else if(sells.ordinal() > 15) {
plankBlock = ForestryBlock.planks2.block();
meta = sells.ordinal() - 16;
} else {
plankBlock = ForestryBlock.planks1.block();
meta = sells.ordinal();
}
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), new ItemStack(plankBlock, 32, meta)));
}