/**
* Clear surrounding furnaces.
*/
private void cleanFurnaces() {
for (Furnace i : furnaces) {
FurnaceInventory fInv = i.getInventory();
ItemStack result = fInv.getResult();
if ((result != null) && (result.getAmount() != 0)) {
// There's something to store.
Material material = result.getType();
int toStore = result.getAmount();
for (Chest j : chest) {
toStore = ChestHandler.deposit(material, toStore, j);
if (toStore == 0) {
break;
}
}
result.setAmount(toStore);
fInv.setResult(result);
}
}
}