Class ItemStackUtils

java.lang.Object
io.github.vampirestudios.vampirelib.utils.ItemStackUtils

public class ItemStackUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    fillAfterItemForCategory(net.minecraft.world.item.Item item, net.minecraft.world.item.Item targetItem, net.minecraft.world.item.CreativeModeTab tab, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> items)
    Used in Item.fillItemCategory(CreativeModeTab, NonNullList) to fill an item after a specific item for a group.
    static int
    findIndexOfItem(net.minecraft.world.level.ItemLike item, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> items)
    Searches for a specific item in a NonNullList of ItemStack and returns its index.
    static boolean
    isAllowedInTab(net.minecraft.world.item.Item item, net.minecraft.world.item.CreativeModeTab tab)
    Checks if an Item is in an CreativeModeTab.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ItemStackUtils

      public ItemStackUtils()
  • Method Details

    • findIndexOfItem

      public static int findIndexOfItem(net.minecraft.world.level.ItemLike item, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> items)
      Searches for a specific item in a NonNullList of ItemStack and returns its index.
      Parameters:
      item - The item to search for.
      items - The list of ItemStacks.
      Returns:
      The index of the specified item in the list, or -1 if it was not in the list.
    • fillAfterItemForCategory

      public static void fillAfterItemForCategory(net.minecraft.world.item.Item item, net.minecraft.world.item.Item targetItem, net.minecraft.world.item.CreativeModeTab tab, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> items)
      Used in Item.fillItemCategory(CreativeModeTab, NonNullList) to fill an item after a specific item for a group.
      Parameters:
      item - The item to fill.
      targetItem - The item to fill after.
      tab - The tab to fill it in.
      items - The NonNullList of item stacks to search for the target item and inject the item in.
    • isAllowedInTab

      public static boolean isAllowedInTab(net.minecraft.world.item.Item item, net.minecraft.world.item.CreativeModeTab tab)
      Checks if an Item is in an CreativeModeTab.
      Parameters:
      item - The Item to check.
      tab - The CreativeModeTab to check.
      Returns:
      Whether the item is in the CreativeModeTab.