{
if ("item".equalsIgnoreCase(e.getName()))
{
int item_id = Integer.parseInt(e.attributeValue("id"));
long count = Long.parseLong(e.attributeValue("count"));
recipe.addMaterial(new RecipeComponent(item_id, count));
}
}
}
else if ("products".equalsIgnoreCase(subElement.getName()))
{
for (Element e : subElement.elements())
{
if ("item".equalsIgnoreCase(e.getName()))
{
int item_id = Integer.parseInt(e.attributeValue("id"));
long count = Long.parseLong(e.attributeValue("count"));
int chance = Integer.parseInt(e.attributeValue("chance"));
recipe.addProduct(new RecipeComponent(item_id, count, chance));
}
}
}
else if ("npc_fee".equalsIgnoreCase(subElement.getName()))
{
for (Element e : subElement.elements())
{
if ("item".equalsIgnoreCase(e.getName()))
{
int item_id = Integer.parseInt(e.attributeValue("id"));
long count = Long.parseLong(e.attributeValue("count"));
recipe.addNpcFee(new RecipeComponent(item_id, count));
}
}
}
}
getHolder().addRecipe(recipe);