private bool CanSmelt() { if (furnaceItemStacks[0] == null) { return(false); } net.minecraft.src.ItemStack itemstack = net.minecraft.src.FurnaceRecipes.Smelting ().GetSmeltingResult(furnaceItemStacks[0].GetItem().ID); 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()); }
protected internal virtual void Func_28126_a(net.minecraft.src.ItemStack itemstack , int i, int j, bool flag) { int k = i; if (flag) { k = j - 1; } if (itemstack.Func_21132_c()) { while (itemstack.stackSize > 0 && (!flag && k < j || flag && k >= i)) { net.minecraft.src.Slot slot = (net.minecraft.src.Slot)inventorySlots[k]; net.minecraft.src.ItemStack itemstack1 = slot.GetStack(); if (itemstack1 != null && itemstack1.itemID == itemstack.itemID && (!itemstack.GetHasSubtypes () || itemstack.GetItemDamage() == itemstack1.GetItemDamage())) { int i1 = itemstack1.stackSize + itemstack.stackSize; if (i1 <= itemstack.GetMaxStackSize()) { itemstack.stackSize = 0; itemstack1.stackSize = i1; slot.OnSlotChanged(); } else { if (itemstack1.stackSize < itemstack.GetMaxStackSize()) { itemstack.stackSize -= itemstack.GetMaxStackSize() - itemstack1.stackSize; itemstack1.stackSize = itemstack.GetMaxStackSize(); slot.OnSlotChanged(); } } } if (flag) { k--; } else { k++; } } } if (itemstack.stackSize > 0) { int l; if (flag) { l = j - 1; } else { l = i; } do { if ((flag || l >= j) && (!flag || l < i)) { break; } net.minecraft.src.Slot slot1 = (net.minecraft.src.Slot)inventorySlots[l]; net.minecraft.src.ItemStack itemstack2 = slot1.GetStack(); if (itemstack2 == null) { slot1.PutStack(itemstack.Copy()); slot1.OnSlotChanged(); itemstack.stackSize = 0; break; } if (flag) { l--; } else { l++; } }while (true); } }
public virtual net.minecraft.src.ItemStack Func_27085_a(int i, int j, bool flag, net.minecraft.src.EntityPlayer entityplayer) { net.minecraft.src.ItemStack itemstack = null; if (j == 0 || j == 1) { net.minecraft.src.InventoryPlayer inventoryplayer = entityplayer.inventory; if (i == -999) { if (inventoryplayer.GetItemStack() != null && i == -999) { if (j == 0) { entityplayer.DropPlayerItem(inventoryplayer.GetItemStack()); inventoryplayer.SetItemStack(null); } if (j == 1) { entityplayer.DropPlayerItem(inventoryplayer.GetItemStack().SplitStack(1)); if (inventoryplayer.GetItemStack().stackSize == 0) { inventoryplayer.SetItemStack(null); } } } } else { if (flag) { net.minecraft.src.ItemStack itemstack1 = Func_27086_a(i); if (itemstack1 != null) { int k = itemstack1.stackSize; itemstack = itemstack1.Copy(); net.minecraft.src.Slot slot1 = (net.minecraft.src.Slot)inventorySlots[i]; if (slot1 != null && slot1.GetStack() != null) { int l = slot1.GetStack().stackSize; if (l < k) { Func_27085_a(i, j, flag, entityplayer); } } } } else { net.minecraft.src.Slot slot = (net.minecraft.src.Slot)inventorySlots[i]; if (slot != null) { slot.OnSlotChanged(); net.minecraft.src.ItemStack itemstack2 = slot.GetStack(); net.minecraft.src.ItemStack itemstack3 = inventoryplayer.GetItemStack(); if (itemstack2 != null) { itemstack = itemstack2.Copy(); } if (itemstack2 == null) { if (itemstack3 != null && slot.IsItemValid(itemstack3)) { int i1 = j != 0 ? 1 : itemstack3.stackSize; if (i1 > slot.GetSlotStackLimit()) { i1 = slot.GetSlotStackLimit(); } slot.PutStack(itemstack3.SplitStack(i1)); if (itemstack3.stackSize == 0) { inventoryplayer.SetItemStack(null); } } } else { if (itemstack3 == null) { int j1 = j != 0 ? (itemstack2.stackSize + 1) / 2 : itemstack2.stackSize; net.minecraft.src.ItemStack itemstack5 = slot.DecrStackSize(j1); inventoryplayer.SetItemStack(itemstack5); if (itemstack2.stackSize == 0) { slot.PutStack(null); } slot.OnPickupFromSlot(inventoryplayer.GetItemStack()); } else { if (slot.IsItemValid(itemstack3)) { if (itemstack2.itemID != itemstack3.itemID || itemstack2.GetHasSubtypes() && itemstack2 .GetItemDamage() != itemstack3.GetItemDamage()) { if (itemstack3.stackSize <= slot.GetSlotStackLimit()) { net.minecraft.src.ItemStack itemstack4 = itemstack2; slot.PutStack(itemstack3); inventoryplayer.SetItemStack(itemstack4); } } else { int k1 = j != 0 ? 1 : itemstack3.stackSize; if (k1 > slot.GetSlotStackLimit() - itemstack2.stackSize) { k1 = slot.GetSlotStackLimit() - itemstack2.stackSize; } if (k1 > itemstack3.GetMaxStackSize() - itemstack2.stackSize) { k1 = itemstack3.GetMaxStackSize() - itemstack2.stackSize; } itemstack3.SplitStack(k1); if (itemstack3.stackSize == 0) { inventoryplayer.SetItemStack(null); } itemstack2.stackSize += k1; } } else { if (itemstack2.itemID == itemstack3.itemID && itemstack3.GetMaxStackSize() > 1 && (!itemstack2.GetHasSubtypes() || itemstack2.GetItemDamage() == itemstack3.GetItemDamage ())) { int l1 = itemstack2.stackSize; if (l1 > 0 && l1 + itemstack3.stackSize <= itemstack3.GetMaxStackSize()) { itemstack3.stackSize += l1; itemstack2.SplitStack(l1); if (itemstack2.stackSize == 0) { slot.PutStack(null); } slot.OnPickupFromSlot(inventoryplayer.GetItemStack()); } } } } } } } } } return(itemstack); }