private bool canSmelt() { if (furnaceItemStacks[0] == null) { return(false); } ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); if (itemstack == null) { return(false); } if (furnaceItemStacks[2] == null) { return(true); } if (!furnaceItemStacks[2].isItemEqual(itemstack)) { return(false); } if (furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize()) { return(true); } return(furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()); }
public void smeltItem() { if (!canSmelt()) { return; } ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); if (furnaceItemStacks[2] == null) { furnaceItemStacks[2] = itemstack.copy(); } else if (furnaceItemStacks[2].itemID == itemstack.itemID) { furnaceItemStacks[2].stackSize++; } furnaceItemStacks[0].stackSize--; if (furnaceItemStacks[0].stackSize <= 0) { furnaceItemStacks[0] = null; } }