Class FabricItemGroup

java.lang.Object
net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup

public final class FabricItemGroup extends Object
Contains a method to create an item group builder.
  • Method Details

    • builder

      public static ItemGroup.Builder builder(Identifier identifier)
      Creates a new builder for ItemGroup. Item groups are used to group items in the creative inventory.

      Each new ItemGroup instance of this class is automatically appended to ItemGroups.getGroups() when ItemGroup.Builder.build() is invoked.

      Example:

      
       private static final ItemGroup ITEM_GROUP = FabricItemGroup.builder(new Identifier(MOD_ID, "test_group"))
          .icon(() -> new ItemStack(Items.DIAMOND))
          .entries((enabledFeatures, entries, operatorEnabled) -> {
             entries.add(TEST_ITEM);
          })
          .build();
       
      Parameters:
      identifier - the id of the ItemGroup, to be used as the default translation key
      Returns:
      a new ItemGroup instance