Class FabricCreativeModeTabOutput

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

public class FabricCreativeModeTabOutput extends Object implements net.minecraft.world.item.CreativeModeTab.Output
This class allows the output of creative mode tabs to be modified by the events in CreativeModeTabEvents.
  • Constructor Details

    • FabricCreativeModeTabOutput

      @Internal public FabricCreativeModeTabOutput(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 creative mode tab. 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 creative mode tab. 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.
    • insertAfter

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

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

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

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

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

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

      public void insertAfter(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 tab, or at the end, if the item isn't in the tab.
      Parameters:
      afterLast - Add newStacks after the last entry of this item in the tab.
      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.
    • insertAfter

      public void insertAfter(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 tab, or at the end, if the stack isn't in the tab.
      Parameters:
      afterLast - Add newStacks after the last creative mode tab output matching this stack (compared using ItemStack.isSameItemSameComponents(ItemStack, 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.
    • insertAfter

      public void insertAfter(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 creative mode tab output matching a predicate, or at the end, if no outputs match.
      Parameters:
      afterLast - Add newStacks after the last creative mode tab output 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.
    • insertBefore

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

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

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

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

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

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

      public void insertBefore(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 tab, or at the end, if the item isn't in the tab.
      Parameters:
      beforeFirst - Add newStacks before the first entry of this item in the tab.
      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.
    • insertBefore

      public void insertBefore(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 creative mode tab, or at the end, if the stack isn't in the creative mode tab.
      Parameters:
      beforeFirst - Add newStacks before the first creative mode tab output matching this stack (compared using ItemStack.isSameItemSameComponents(ItemStack, 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.
    • insertBefore

      public void insertBefore(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 tab output matching a predicate, or at the end, if no output match.
      Parameters:
      beforeFirst - Add newStacks before the first tab output 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.