private boolean canSmelt() { if (contents[0] == null) { return false; } else { ItemStack stack = FurnaceRecipes.smelting().getSmeltingResult(contents[0]); if (stack == null) return false; if (contents[2] == null) return true; if (!contents[2].isItemEqual(stack)) return false; int result = contents[2].stackSize + stack.stackSize; return result <= getInventoryStackLimit() && result <= contents[2].getMaxStackSize(); } }
public void smeltItem() { if (canSmelt()) { ItemStack stack = FurnaceRecipes.smelting().getSmeltingResult(contents[0]); if (contents[2] == null) { contents[2] = stack.copy(); } else if (contents[2].getItem() == stack.getItem()) { contents[2].stackSize += stack.stackSize; } contents[0].stackSize--; if (contents[0].stackSize <= 0) { contents[0] = null; } } }