Class FabricItemGroupBuilder

java.lang.Object
net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder

public final class FabricItemGroupBuilder
extends Object
  • Method Details

    • create

      public static FabricItemGroupBuilder create​(net.minecraft.util.Identifier identifier)
      Create a new Item Group Builder.
      Parameters:
      identifier - the id will become the name of the ItemGroup and will be used for the translation key
      Returns:
      a FabricItemGroupBuilder
    • icon

      public FabricItemGroupBuilder icon​(Supplier<net.minecraft.item.ItemStack> stackSupplier)
      This is used to add an icon to to the item group.
      Parameters:
      stackSupplier - the supplier should return the item stack that you wish to show on the tab
      Returns:
      a reference to the FabricItemGroupBuilder
    • stacksForDisplay

      @Deprecated public FabricItemGroupBuilder stacksForDisplay​(Consumer<List<net.minecraft.item.ItemStack>> appender)
      Deprecated.
      This allows for a custom list of items to be displayed in a tab, this enabled tabs to be created with a custom set of items.
      Parameters:
      appender - Add ItemStack's to this list to show in the ItemGroup
      Returns:
      a reference to the FabricItemGroupBuilder
    • appendItems

      public FabricItemGroupBuilder appendItems​(Consumer<List<net.minecraft.item.ItemStack>> stacksForDisplay)
      This allows for a custom list of items to be displayed in a tab, this enabled tabs to be created with a custom set of items.
      Parameters:
      stacksForDisplay - Add ItemStack's to this list to show in the ItemGroup
      Returns:
      a reference to the FabricItemGroupBuilder
    • build

      public static net.minecraft.item.ItemGroup build​(net.minecraft.util.Identifier identifier, Supplier<net.minecraft.item.ItemStack> stackSupplier)
      This is a single method that makes creating an ItemGroup with an icon one call.
      Parameters:
      identifier - the id will become the name of the ItemGroup and will be used for the translation key
      stackSupplier - the supplier should return the item stack that you wish to show on the tab
      Returns:
      An instance of the built ItemGroup
    • build

      public net.minecraft.item.ItemGroup build()
      Create an instance of the ItemGroup.
      Returns:
      An instance of the built ItemGroup