Block b = SignUtil.getBackBlock(event.getBlock());
Block fire = b.getRelative(0, 1, 0);
Block cb = b.getRelative(0, 2, 0);
if (cb.getType() == Material.CHEST) {
if (fire.getType() == Material.FIRE) {
Chest chest = (Chest) cb.getState();
List<ItemStack> items;
if(cookingPotOres)
items = ItemUtil.getRawMaterials(chest.getInventory());
else
items = ItemUtil.getRawFood(chest.getInventory());
if(items.size() == 0) return;
if(lastTick < 500) {
lastTick = cookingPotSuperFast ? lastTick + getMultiplier(sign) : lastTick + Math.min(getMultiplier(sign), 5);
if(getMultiplier(sign) > 0)
decreaseMultiplier(sign, 1);
}
if (lastTick >= 50) {
for (ItemStack i : items) {
if (!ItemUtil.isStackValid(i)) continue;
ItemStack cooked = ItemUtil.getCookedResult(i);
if (cooked == null) {
if (cookingPotOres)
cooked = ItemUtil.getSmeletedResult(i);
if (cooked == null) continue;
}
if (chest.getInventory().addItem(cooked).isEmpty()) {
ItemStack toRemove = i.clone();
toRemove.setAmount(1);
chest.getInventory().removeItem(toRemove);
chest.update();
lastTick -= 50;
break;
}
}
}