private boolean doPick( final @Nonnull ItemStack result ) { final EntityPlayer player = getPlayer(); for ( int x = 0; x < 9; x++ ) { final ItemStack stack = player.inventory.getStackInSlot( x ); if ( stack != null && stack.isItemEqual( result ) && ItemStack.areItemStackTagsEqual( stack, result ) ) { player.inventory.currentItem = x; return true; } } if ( !player.capabilities.isCreativeMode ) { return false; } int slot = player.inventory.getFirstEmptyStack(); if ( slot < 0 || slot >= 9 ) { slot = player.inventory.currentItem; } // update inventory.. player.inventory.setInventorySlotContents( slot, result ); player.inventory.currentItem = slot; // update server... final int j = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; Minecraft.getMinecraft().playerController.sendSlotPacket( player.inventory.getStackInSlot( player.inventory.currentItem ), j ); return true; }
if (isShiftKeyDown()) { InventoryPlayer playerInv = mc.player.inventory; targetSlot = playerInv.getFirstEmptyStack(); if (targetSlot >= 0) { targetSlot = getContainer().getSlotIndex(playerInv, targetSlot);
/** * Depopulates the itemStack's list of stored items and inserts them into the inventory. * @param itemStack The ItemStack to depopulate * @param inventory The inventory populate */ private static void depopulate(ItemStack itemStack, InventoryPlayer inventory) { NBTTagList list = itemStack.getTagCompound().getTagList("Items", Constants.NBT.TAG_COMPOUND).copy(); NBTTagList remainingItems = new NBTTagList(); for (int i = 0; i < list.tagCount(); i++) { ItemStack containedStack = new ItemStack(list.getCompoundTagAt(i)); int emptySlotID = inventory.getFirstEmptyStack(); // loadItemStackFromNBT can in fact return null. //noinspection ConstantConditions if (containedStack != null) { if (emptySlotID == -1) { remainingItems.appendTag(containedStack.serializeNBT()); } else { inventory.setInventorySlotContents(emptySlotID, containedStack); } } } itemStack.getTagCompound().setTag("Items", remainingItems); } }
final int emptySlot = player.inventory.getFirstEmptyStack(); pullInfoFromHut();
final int emptySlot = player.inventory.getFirstEmptyStack(); pullInfoFromHut();
final int emptySlot = player.inventory.getFirstEmptyStack(); BlockPosUtil.writeToNBT(compound, TAG_POS, message.buildingId); compound.setInteger(TAG_ID, message.colonyId);
dropOff = player.inventory.getFirstEmptyStack(); if (dropOff < 0) { return;
l1 = inventoryPlayer.getFirstEmptyStack(); flag |= l1 > -1;