Class FabricItemGroupEntries

java.lang.Object
net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries
All Implemented Interfaces:
net.minecraft.world.item.CreativeModeTab.Output

public class FabricItemGroupEntries extends Object implements net.minecraft.world.item.CreativeModeTab.Output
This class allows the entries of item groups to be modified by the events in ItemGroupEvents.
  • Constructor Details

    • FabricItemGroupEntries

      @Internal public FabricItemGroupEntries(net.minecraft.world.item.CreativeModeTab.ItemDisplayParameters context, List<net.minecraft.world.item.ItemStack> displayStacks, List<net.minecraft.world.item.ItemStack> searchTabStacks)
  • Method Details

    • getContext

      public net.minecraft.world.item.CreativeModeTab.ItemDisplayParameters getContext()
    • getEnabledFeatures

      public net.minecraft.world.flag.FeatureFlagSet getEnabledFeatures()
      Returns:
      the currently enabled feature set
    • shouldShowOpRestrictedItems

      public boolean shouldShowOpRestrictedItems()
      Returns:
      whether to show items restricted to operators, such as command blocks
    • getDisplayStacks

      public List<net.minecraft.world.item.ItemStack> getDisplayStacks()
      Returns:
      the stacks that will be shown in the tab in the creative mode inventory
      API Note:
      This list can be modified.
    • getSearchTabStacks

      public List<net.minecraft.world.item.ItemStack> getSearchTabStacks()
      Returns:
      the stacks that will be searched by the creative mode inventory search
      API Note:
      This list can be modified.
    • accept

      public void accept(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds a stack to the end of the item group. Duplicate stacks will be removed.
      Specified by:
      accept in interface net.minecraft.world.item.CreativeModeTab.Output
      Parameters:
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.
    • prepend

      public void prepend(net.minecraft.world.item.ItemStack stack)
      See prepend(ItemStack, CreativeModeTab.TabVisibility). Will use CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS for visibility.
    • prepend

      public void prepend(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds a stack to the beginning of the item group. Duplicate stacks will be removed.
      Parameters:
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.
    • prepend

      public void prepend(net.minecraft.world.level.ItemLike item)
      See prepend(ItemStack). Automatically creates an ItemStack from the given item.
    • prepend

      public void prepend(net.minecraft.world.level.ItemLike item, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      See prepend(ItemStack, net.minecraft.world.item.CreativeModeTab.TabVisibility). Automatically creates an ItemStack from the given item.
    • addAfter

      public void addAfter(net.minecraft.world.level.ItemLike afterLast, net.minecraft.world.item.ItemStack... newStack)
    • addAfter

      public void addAfter(net.minecraft.world.item.ItemStack afterLast, net.minecraft.world.item.ItemStack... newStack)
    • addAfter

      public void addAfter(net.minecraft.world.level.ItemLike afterLast, net.minecraft.world.level.ItemLike... newItem)
    • addAfter

      public void addAfter(net.minecraft.world.item.ItemStack afterLast, net.minecraft.world.level.ItemLike... newItem)
    • addAfter

      public void addAfter(net.minecraft.world.level.ItemLike afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks)
    • addAfter

      public void addAfter(net.minecraft.world.item.ItemStack afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks)
    • addAfter

      public void addAfter(net.minecraft.world.level.ItemLike afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds stacks after an existing item in the group, or at the end, if the item isn't in the group.
      Parameters:
      afterLast - Add newStacks after the last entry of this item in the group.
      newStacks - The stacks to add. Only enabled stacks will be added.
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.
    • addAfter

      public void addAfter(net.minecraft.world.item.ItemStack afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds stacks after an existing stack in the group, or at the end, if the stack isn't in the group.
      Parameters:
      afterLast - Add newStacks after the last group entry matching this stack (compared using ItemStack.isSameItemSameComponents(net.minecraft.world.item.ItemStack, net.minecraft.world.item.ItemStack)).
      newStacks - The stacks to add. Only enabled stacks will be added.
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.
    • addAfter

      public void addAfter(Predicate<net.minecraft.world.item.ItemStack> afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds stacks after the last group entry matching a predicate, or at the end, if no entries match.
      Parameters:
      afterLast - Add newStacks after the last group entry matching this predicate.
      newStacks - The stacks to add. Only enabled stacks will be added.
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.
    • addBefore

      public void addBefore(net.minecraft.world.level.ItemLike beforeFirst, net.minecraft.world.item.ItemStack... newStack)
    • addBefore

      public void addBefore(net.minecraft.world.item.ItemStack beforeFirst, net.minecraft.world.item.ItemStack... newStack)
    • addBefore

      public void addBefore(net.minecraft.world.level.ItemLike beforeFirst, net.minecraft.world.level.ItemLike... newItem)
    • addBefore

      public void addBefore(net.minecraft.world.item.ItemStack beforeFirst, net.minecraft.world.level.ItemLike... newItem)
    • addBefore

      public void addBefore(net.minecraft.world.level.ItemLike beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks)
    • addBefore

      public void addBefore(net.minecraft.world.item.ItemStack beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks)
    • addBefore

      public void addBefore(net.minecraft.world.level.ItemLike beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds stacks before an existing item in the group, or at the end, if the item isn't in the group.
      Parameters:
      beforeFirst - Add newStacks before the first entry of this item in the group.
      newStacks - The stacks to add. Only enabled stacks will be added.
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.
    • addBefore

      public void addBefore(net.minecraft.world.item.ItemStack beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds stacks before an existing stack to the group, or at the end, if the stack isn't in the group.
      Parameters:
      beforeFirst - Add newStacks before the first group entry matching this stack (compared using ItemStack.isSameItemSameComponents(net.minecraft.world.item.ItemStack, net.minecraft.world.item.ItemStack)).
      newStacks - The stacks to add. Only enabled stacks will be added.
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.
    • addBefore

      public void addBefore(Predicate<net.minecraft.world.item.ItemStack> beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility)
      Adds stacks before the first group entry matching a predicate, or at the end, if no entries match.
      Parameters:
      beforeFirst - Add newStacks before the first group entry matching this predicate.
      newStacks - The stacks to add. Only enabled stacks will be added.
      visibility - Determines whether the stack will be shown in the tab itself, returned for searches, or both.