Java Code Examples for codechicken.lib.inventory.InventoryUtils#copyStack()
The following examples show how to use
codechicken.lib.inventory.InventoryUtils#copyStack() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnderStorageRecipe.java From EnderStorage with MIT License | 6 votes |
public ItemStack getCraftingResult(InventoryCrafting ic) { for (int row = 0; row < 2; row++) { if (!offsetMatchesDyes(ic, 0, row)) continue; ItemStack freqowner = ic.getStackInRowAndColumn(1, row + 1); int freq = freqowner.getItemDamage() & 0xFFF; int colour1 = recolour(0, row, freq, ic); int colour2 = recolour(1, row, freq, ic); int colour3 = recolour(2, row, freq, ic); ItemStack result = InventoryUtils.copyStack(freqowner, 1); result.setItemDamage(EnderStorageManager.getFreqFromColours(colour3, colour2, colour1) | freqowner.getItemDamage() & 0xF000); return result; } return null; }
Example 2
Source File: TileCraftingGrid.java From Translocators with MIT License | 6 votes |
public void activate(int subHit, EntityPlayer player) { ItemStack held = player.inventory.getCurrentItem(); if (held == null) { if (items[subHit] != null) giveOrDropItem(items[subHit], player); items[subHit] = null; } else { if (!InventoryUtils.areStacksIdentical(held, items[subHit])) { ItemStack old = items[subHit]; items[subHit] = InventoryUtils.copyStack(held, 1); player.inventory.decrStackSize(player.inventory.currentItem, 1); if (old != null) giveOrDropItem(old, player); } } timeout = 2400; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); }
Example 3
Source File: SlotDummy.java From CodeChickenCore with MIT License | 5 votes |
@Override public void putStack(ItemStack stack) { if(stack != null && stack.stackSize > stackLimit) stack = InventoryUtils.copyStack(stack, stackLimit); super.putStack(stack); }
Example 4
Source File: TileItemTranslocator.java From Translocators with MIT License | 5 votes |
private void spreadOutput(ItemStack move, int src, boolean rspass, InventoryRange[] attached) { if(move.stackSize == 0) return; int outputCount = 0; int[] outputQuantities = new int[6]; for(int i = 0; i < 6; i++) { ItemAttachment ia = (ItemAttachment) attachments[i]; if(ia != null && !ia.a_eject && ia.redstone == rspass) { outputQuantities[i] = insertAmount(move, ia, attached[i]); if(outputQuantities[i] > 0) outputCount++; } } for(int dst = 0; dst < 6 && move.stackSize > 0; dst++) { int qty = outputQuantities[dst]; if(qty <= 0) continue; qty = Math.min(qty, move.stackSize/outputCount + worldObj.rand.nextInt(move.stackSize%outputCount+1)); outputCount--; if(qty == 0) continue; InventoryRange range = attached[dst]; ItemStack add = InventoryUtils.copyStack(move, qty); InventoryUtils.insertItem(range, add, false); move.stackSize-=qty; sendTransferPacket(src, dst, add); } }
Example 5
Source File: InfiniteStackSizeHandler.java From NotEnoughItems with MIT License | 4 votes |
@Override public ItemStack getInfiniteItem(ItemStack typeStack) { return InventoryUtils.copyStack(typeStack, -1); }
Example 6
Source File: DefaultOverlayHandler.java From NotEnoughItems with MIT License | 4 votes |
public DistributedIngred(ItemStack item) { stack = InventoryUtils.copyStack(item, 1); }