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
ConstructorDescriptionFabricItemGroupEntries
(ItemGroup.DisplayContext context, List<ItemStack> displayStacks, List<ItemStack> searchTabStacks) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ItemStack stack, ItemGroup.StackVisibility visibility) Adds a stack to the end of the item group.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.void
addAfter
(ItemConvertible afterLast, Collection<ItemStack> newStacks) 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.void
addAfter
(ItemConvertible afterLast, ItemConvertible... newItem) void
addAfter
(ItemConvertible afterLast, ItemStack... newStack) void
addAfter
(ItemStack afterLast, Collection<ItemStack> newStacks) 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.void
addAfter
(ItemStack afterLast, ItemConvertible... newItem) void
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.void
addBefore
(ItemConvertible beforeFirst, Collection<ItemStack> newStacks) 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.void
addBefore
(ItemConvertible beforeFirst, ItemConvertible... newItem) void
addBefore
(ItemConvertible beforeFirst, ItemStack... newStack) void
addBefore
(ItemStack beforeFirst, Collection<ItemStack> newStacks) 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.void
addBefore
(ItemStack beforeFirst, ItemConvertible... newItem) void
void
prepend
(ItemConvertible item) Seeprepend(ItemStack)
.void
prepend
(ItemConvertible item, ItemGroup.StackVisibility visibility) void
void
prepend
(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:
add
in 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_TABS
for 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 anItemStack
from the given item. -
prepend
Seeprepend(ItemStack, net.minecraft.item.ItemGroup.StackVisibility)
. Automatically creates anItemStack
from 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
- AddnewStacks
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(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
- AddnewStacks
after 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
- AddnewStacks
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
-
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
- AddnewStacks
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(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
- AddnewStacks
before 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
- AddnewStacks
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.
-