Class FabricItemGroupEntries
java.lang.Object
net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries
- All Implemented Interfaces:
ItemGroup.Entries
This class allows the entries of item groups to be modified by the events in
ItemGroupEvents.-
Constructor Summary
ConstructorsConstructorDescriptionFabricItemGroupEntries(ItemGroup.DisplayContext context, List<ItemStack> displayStacks, List<ItemStack> searchTabStacks) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ItemStack stack, ItemGroup.StackVisibility visibility) Adds a stack to the end of the item group.voidaddAfter(Predicate<ItemStack> afterLast, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks after the last group entry matching a predicate, or at the end, if no entries match.voidaddAfter(ItemConvertible afterLast, Collection<ItemStack> newStacks) voidaddAfter(ItemConvertible afterLast, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks after an existing item in the group, or at the end, if the item isn't in the group.voidaddAfter(ItemConvertible afterLast, ItemConvertible... newItem) voidaddAfter(ItemConvertible afterLast, ItemStack... newStack) voidaddAfter(ItemStack afterLast, Collection<ItemStack> newStacks) voidaddAfter(ItemStack afterLast, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks after an existing stack in the group, or at the end, if the stack isn't in the group.voidaddAfter(ItemStack afterLast, ItemConvertible... newItem) voidvoidaddBefore(Predicate<ItemStack> beforeFirst, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks before the first group entry matching a predicate, or at the end, if no entries match.voidaddBefore(ItemConvertible beforeFirst, Collection<ItemStack> newStacks) voidaddBefore(ItemConvertible beforeFirst, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks before an existing item in the group, or at the end, if the item isn't in the group.voidaddBefore(ItemConvertible beforeFirst, ItemConvertible... newItem) voidaddBefore(ItemConvertible beforeFirst, ItemStack... newStack) voidaddBefore(ItemStack beforeFirst, Collection<ItemStack> newStacks) voidaddBefore(ItemStack beforeFirst, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks before an existing stack to the group, or at the end, if the stack isn't in the group.voidaddBefore(ItemStack beforeFirst, ItemConvertible... newItem) voidvoidprepend(ItemConvertible item) Seeprepend(ItemStack).voidprepend(ItemConvertible item, ItemGroup.StackVisibility visibility) voidvoidprepend(ItemStack stack, ItemGroup.StackVisibility visibility) Adds a stack to the beginning of the item group.boolean
-
Constructor Details
-
FabricItemGroupEntries
@Internal public FabricItemGroupEntries(ItemGroup.DisplayContext context, List<ItemStack> displayStacks, List<ItemStack> searchTabStacks)
-
-
Method Details
-
getContext
-
getEnabledFeatures
- Returns:
- the currently enabled feature set
-
shouldShowOpRestrictedItems
public boolean shouldShowOpRestrictedItems()- Returns:
- whether to show items restricted to operators, such as command blocks
-
getDisplayStacks
- Returns:
- the stacks that will be shown in the tab in the creative mode inventory
- API Note:
- This list can be modified.
-
getSearchTabStacks
- Returns:
- the stacks that will be searched by the creative mode inventory search
- API Note:
- This list can be modified.
-
add
Adds a stack to the end of the item group. Duplicate stacks will be removed.- Specified by:
addin interfaceItemGroup.Entries- Parameters:
visibility- Determines whether the stack will be shown in the tab itself, returned for searches, or both.
-
prepend
Seeprepend(ItemStack, ItemGroup.StackVisibility). Will useItemGroup.StackVisibility.PARENT_AND_SEARCH_TABSfor visibility. -
prepend
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
Seeprepend(ItemStack). Automatically creates anItemStackfrom the given item. -
prepend
Seeprepend(ItemStack, net.minecraft.item.ItemGroup.StackVisibility). Automatically creates anItemStackfrom the given item. -
addAfter
-
addAfter
-
addAfter
-
addAfter
-
addAfter
-
addAfter
-
addAfter
public void addAfter(ItemConvertible afterLast, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks after an existing item in the group, or at the end, if the item isn't in the group.- Parameters:
afterLast- AddnewStacksafter 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(ItemStack afterLast, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks after an existing stack in the group, or at the end, if the stack isn't in the group.- Parameters:
afterLast- AddnewStacksafter the last group entry matching this stack (compared usingItemStack.canCombine(net.minecraft.item.ItemStack, net.minecraft.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<ItemStack> afterLast, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks after the last group entry matching a predicate, or at the end, if no entries match.- Parameters:
afterLast- AddnewStacksafter 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
-
addBefore
-
addBefore
-
addBefore
-
addBefore
-
addBefore
-
addBefore
public void addBefore(ItemConvertible beforeFirst, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks before an existing item in the group, or at the end, if the item isn't in the group.- Parameters:
beforeFirst- AddnewStacksbefore 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(ItemStack beforeFirst, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks before an existing stack to the group, or at the end, if the stack isn't in the group.- Parameters:
beforeFirst- AddnewStacksbefore the first group entry matching this stack (compared usingItemStack.canCombine(net.minecraft.item.ItemStack, net.minecraft.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<ItemStack> beforeFirst, Collection<ItemStack> newStacks, ItemGroup.StackVisibility visibility) Adds stacks before the first group entry matching a predicate, or at the end, if no entries match.- Parameters:
beforeFirst- AddnewStacksbefore 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.
-