Java Code Examples for net.minecraft.item.ItemStack#split()
The following examples show how to use
net.minecraft.item.ItemStack#split() .
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: InventoryUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
/** * Static default implementation for IInventory method */ @Nonnull public static ItemStack decrStackSize(IInventory inv, int slot, int size) { ItemStack item = inv.getStackInSlot(slot); if (!item.isEmpty()) { if (item.getCount() <= size) { inv.setInventorySlotContents(slot, ItemStack.EMPTY); inv.markDirty(); return item; } ItemStack itemstack1 = item.split(size); if (item.getCount() == 0) { inv.setInventorySlotContents(slot, ItemStack.EMPTY); } else { inv.setInventorySlotContents(slot, item); } inv.markDirty(); return itemstack1; } return ItemStack.EMPTY; }
Example 2
Source File: DropperBlock_craftingMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 5 votes |
private void spawn(World world_1, double double_1, double double_2, double double_3, ItemStack itemStack_1) { while(!itemStack_1.isEmpty()) { ItemEntity itemEntity_1 = new ItemEntity(world_1, double_1, double_2, double_3, itemStack_1.split(CarpetServer.rand.nextInt(21) + 10)); itemEntity_1.setVelocity( (CarpetServer.rand.nextDouble()-CarpetServer.rand.nextDouble()) * 0.05, CarpetServer.rand.nextDouble() * 0.05, (CarpetServer.rand.nextDouble()-CarpetServer.rand.nextDouble()) * 0.05 ); world_1.spawnEntity(itemEntity_1); } }
Example 3
Source File: InfusionAltarBlockEntity.java From the-hallow with MIT License | 4 votes |
public ItemStack putStack(ItemStack insertStack) { if (storedStack.isEmpty() && insertStack.getCount() >= 1) { storedStack = insertStack.split(1); } return insertStack; }
Example 4
Source File: InfusionPillarBlockEntity.java From the-hallow with MIT License | 4 votes |
public ItemStack putStack(ItemStack insertStack) { if (storedStack.isEmpty() && insertStack.getCount() >= 1) { storedStack = insertStack.split(1); } return insertStack; }