/** * Determine if a player is holding an ItemStack with a specific Item ID and Metadata. */ public static boolean isPlayerHoldingItemStack(ItemStack stack, EntityPlayer player) { return itemsEqualWithMetadata(stack, getHeldStack(player)); }
/** * Determine if two ItemStacks have the same Item, damage, and NBT. */ public static boolean itemsEqualWithMetadata(ItemStack stackA, ItemStack stackB, boolean checkNBT) { return itemsEqualWithMetadata(stackA, stackB) && (!checkNBT || doNBTsMatch(stackA.getTagCompound(), stackB.getTagCompound())); }
@Override public void stuffItem(ItemStack item) { for (ItemStack stuffed : stuffedItems) { if (ItemHelper.itemsEqualWithMetadata(item, stuffed, true)) { stuffed.grow(item.getCount()); if (stuffed.getCount() < 0) { stuffed.setCount(Integer.MAX_VALUE); } return; } } stuffedItems.add(item.copy()); onNeighborChange(); }
for (ItemStack seed : registeredSeeds) { for (ItemStack crop : registeredCrops) { if (ItemHelper.itemsEqualWithMetadata(seed, crop)) { isTuber = true;
if (ItemHelper.itemsEqualWithMetadata(slot1.getStack(), stack)) { return ItemStack.EMPTY;
if (ItemHelper.itemsEqualWithMetadata(slot1.getStack(), stack)) { return ItemStack.EMPTY;
public void tickItemInUse(ItemStack updateItem) { if (!updateItem.isEmpty() && ItemHelper.itemsEqualWithMetadata(previousItem, activeItemStack)) { activeItemStackUseCount = ForgeEventFactory.onItemUseTick(this, activeItemStack, activeItemStackUseCount); if (activeItemStackUseCount <= 0) { onItemUseFinish(); } else { activeItemStack.getItem().onUsingTick(activeItemStack, this, activeItemStackUseCount); if (activeItemStackUseCount <= 25 && activeItemStackUseCount % 4 == 0) { updateItemUse(updateItem, 5); } if (--activeItemStackUseCount == 0 && !world.isRemote) { onItemUseFinish(); } } } else { resetActiveHand(); } }
amount -= toExtract; } else if (ItemHelper.itemsEqualWithMetadata(stack, queryStack, true)) { int toExtract = Math.min(stack.getMaxStackSize() - stack.getCount(), Math.min(amount, queryStack.getCount())); ItemStack extracted = inv.extractItem(i, toExtract, false);
stackInSlot = slot.getStack(); if (slot.isItemValid(stack) && ItemHelper.itemsEqualWithMetadata(stack, stackInSlot, true)) { int l = stackInSlot.getCount() + stack.getCount(); int slotLimit = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
stackInSlot = slot.getStack(); if (slot.isItemValid(stack) && ItemHelper.itemsEqualWithMetadata(stack, stackInSlot, true)) { int l = stackInSlot.getCount() + stack.getCount(); int slotLimit = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
for (slot++; slot < getCachedInv().getSlots() && travelingItem.stack.getCount() < totalSendSize; slot++) { item = getCachedInv().getStackInSlot(slot); if (ItemHelper.itemsEqualWithMetadata(travelingItem.stack, item, true)) { item = getCachedInv().extractItem(slot, totalSendSize - travelingItem.stack.getCount(), false); if (!item.isEmpty()) {
if (ItemHelper.itemsEqualWithMetadata(inv.getStackInSlot(slot), item, true)) { ItemStack extract = inv.extractItem(slot, maxStackSize - item.getCount(), false); if (!extract.isEmpty()) {