Incorrect amount of amountOfValidBlocks in teachRecipe
averman opened this issue ยท 1 comments
This code count the amount of OreDictionary entries with word wood in it. But one stack can have multiple entries of OreDictionary, in my case my oak wood plank have these 2 entries: plankWood and plankLightWood
but the count of the blocks are outside this, so if I make a button using oak wood plank, the value of amountOfValidBlocks will be 2 but the blocks will be 1
I think this will solve the problem
`
for(final ItemStack stack : storage.getInput())
{
if(!ItemStackUtils.isEmpty(stack))
{
boolean isWood = false;
for(final int id: OreDictionary.getOreIDs(stack))
{
final String name = OreDictionary.getOreName(id);
if(name.contains("Wood"))
{
isWood = true;
}
else if(name.contains("ingot") || name.contains("stone") || name.contains("redstone") || name.contains("string"))
{
return false;
}
}
if(isWood) amountOfValidBlocks++;
blocks++;
}
}
`