public virtual void SmeltItem() { if (!CanSmelt()) { return; } net.minecraft.src.ItemStack itemstack = net.minecraft.src.FurnaceRecipes.Smelting ().GetSmeltingResult(furnaceItemStacks[0].GetItem().ID); 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; } }
public override net.minecraft.src.ItemStack Func_27086_a(int i) { net.minecraft.src.ItemStack itemstack = null; net.minecraft.src.Slot slot = (net.minecraft.src.Slot)inventorySlots[i]; if (slot != null && slot.Func_27006_b()) { net.minecraft.src.ItemStack itemstack1 = slot.GetStack(); itemstack = itemstack1.Copy(); if (i < field_27088_b * 9) { Func_28126_a(itemstack1, field_27088_b * 9, inventorySlots.Count, true); } else { Func_28126_a(itemstack1, 0, field_27088_b * 9, false); } if (itemstack1.stackSize == 0) { slot.PutStack(null); } else { slot.OnSlotChanged(); } } return(itemstack); }
public Packet103SetSlot(int i, int j, net.minecraft.src.ItemStack itemstack) { // Referenced classes of package net.minecraft.src: // Packet, ItemStack, NetHandler windowId = i; itemSlot = j; myItemStack = itemstack != null?itemstack.Copy() : itemstack; }
public Packet104WindowItems(int i, System.Collections.IList list) { // Referenced classes of package net.minecraft.src: // Packet, ItemStack, NetHandler windowId = i; itemStack = new net.minecraft.src.ItemStack[list.Count]; for (int j = 0; j < itemStack.Length; j++) { net.minecraft.src.ItemStack itemstack = (net.minecraft.src.ItemStack)list[j]; itemStack[j] = itemstack != null?itemstack.Copy() : null; } }
public override net.minecraft.src.ItemStack Func_27086_a(int i) { net.minecraft.src.ItemStack itemstack = null; net.minecraft.src.Slot slot = (net.minecraft.src.Slot)inventorySlots[i]; if (slot != null && slot.Func_27006_b()) { net.minecraft.src.ItemStack itemstack1 = slot.GetStack(); itemstack = itemstack1.Copy(); if (i == 2) { Func_28126_a(itemstack1, 3, 39, true); } else { if (i >= 3 && i < 30) { Func_28126_a(itemstack1, 30, 39, false); } else { if (i >= 30 && i < 39) { Func_28126_a(itemstack1, 3, 30, false); } else { Func_28126_a(itemstack1, 3, 39, false); } } } if (itemstack1.stackSize == 0) { slot.PutStack(null); } else { slot.OnSlotChanged(); } if (itemstack1.stackSize != itemstack.stackSize) { slot.OnPickupFromSlot(itemstack1); } else { return(null); } } return(itemstack); }
public virtual void UpdateCraftingMatrix() { for (int i = 0; i < inventorySlots.Count; i++) { net.minecraft.src.ItemStack itemstack = ((net.minecraft.src.Slot)inventorySlots[i ]).GetStack(); net.minecraft.src.ItemStack itemstack1 = (net.minecraft.src.ItemStack)inventoryItemStacks [i]; if (net.minecraft.src.ItemStack.AreItemStacksEqual(itemstack1, itemstack)) { continue; } itemstack1 = itemstack != null?itemstack.Copy() : null; inventoryItemStacks[i] = itemstack1; for (int j = 0; j < crafters.Count; j++) { ((net.minecraft.src.ICrafting)crafters[j]).UpdateCraftingInventorySlot(this, i, itemstack1 ); } } }
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); }
public static net.minecraft.src.ItemStack CloneStack(net.minecraft.src.ItemStack itemstack) { return(itemstack != null?itemstack.Copy() : null); }