Class FabricItemGroupEntries
java.lang.Object
net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries
- All Implemented Interfaces:
net.minecraft.world.item.CreativeModeTab.Output
public class FabricItemGroupEntries
extends Object
implements net.minecraft.world.item.CreativeModeTab.Output
This class allows the entries of item groups to be modified by the events in
ItemGroupEvents.-
Constructor Summary
ConstructorsConstructorDescriptionFabricItemGroupEntries(net.minecraft.world.item.CreativeModeTab.ItemDisplayParameters context, List<net.minecraft.world.item.ItemStack> displayStacks, List<net.minecraft.world.item.ItemStack> searchTabStacks) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility) Adds a stack to the end of the item group.voidaddAfter(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 group entry matching a predicate, or at the end, if no entries match.voidaddAfter(net.minecraft.world.item.ItemStack afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks) voidaddAfter(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 group, or at the end, if the stack isn't in the group.voidaddAfter(net.minecraft.world.item.ItemStack afterLast, net.minecraft.world.item.ItemStack... newStack) voidaddAfter(net.minecraft.world.item.ItemStack afterLast, net.minecraft.world.level.ItemLike... newItem) voidaddAfter(net.minecraft.world.level.ItemLike afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks) voidaddAfter(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 group, or at the end, if the item isn't in the group.voidaddAfter(net.minecraft.world.level.ItemLike afterLast, net.minecraft.world.item.ItemStack... newStack) voidaddAfter(net.minecraft.world.level.ItemLike afterLast, net.minecraft.world.level.ItemLike... newItem) voidaddBefore(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 group entry matching a predicate, or at the end, if no entries match.voidaddBefore(net.minecraft.world.item.ItemStack beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks) voidaddBefore(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 group, or at the end, if the stack isn't in the group.voidaddBefore(net.minecraft.world.item.ItemStack beforeFirst, net.minecraft.world.item.ItemStack... newStack) voidaddBefore(net.minecraft.world.item.ItemStack beforeFirst, net.minecraft.world.level.ItemLike... newItem) voidaddBefore(net.minecraft.world.level.ItemLike beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks) voidaddBefore(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 group, or at the end, if the item isn't in the group.voidaddBefore(net.minecraft.world.level.ItemLike beforeFirst, net.minecraft.world.item.ItemStack... newStack) voidaddBefore(net.minecraft.world.level.ItemLike beforeFirst, net.minecraft.world.level.ItemLike... newItem) net.minecraft.world.item.CreativeModeTab.ItemDisplayParametersList<net.minecraft.world.item.ItemStack> net.minecraft.world.flag.FeatureFlagSetList<net.minecraft.world.item.ItemStack> voidprepend(net.minecraft.world.item.ItemStack stack) voidprepend(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility) Adds a stack to the beginning of the item group.voidprepend(net.minecraft.world.level.ItemLike item) Seeprepend(ItemStack).voidprepend(net.minecraft.world.level.ItemLike item, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility) booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.item.CreativeModeTab.Output
accept, accept, accept, acceptAll, acceptAll
-
Constructor Details
-
FabricItemGroupEntries
-
-
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
- 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.
-
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 item group. Duplicate stacks will be removed.- Specified by:
acceptin interfacenet.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) Seeprepend(ItemStack, CreativeModeTab.TabVisibility). Will useCreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABSfor 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 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
public void prepend(net.minecraft.world.level.ItemLike item) Seeprepend(ItemStack). Automatically creates anItemStackfrom the given item. -
prepend
public void prepend(net.minecraft.world.level.ItemLike item, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility) Seeprepend(ItemStack, net.minecraft.world.item.CreativeModeTab.TabVisibility). Automatically creates anItemStackfrom the given item. -
addAfter
public void addAfter(net.minecraft.world.level.ItemLike afterLast, net.minecraft.world.item.ItemStack... newStack) -
addAfter
public void addAfter(net.minecraft.world.item.ItemStack afterLast, net.minecraft.world.item.ItemStack... newStack) -
addAfter
public void addAfter(net.minecraft.world.level.ItemLike afterLast, net.minecraft.world.level.ItemLike... newItem) -
addAfter
public void addAfter(net.minecraft.world.item.ItemStack afterLast, net.minecraft.world.level.ItemLike... newItem) -
addAfter
public void addAfter(net.minecraft.world.level.ItemLike afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks) -
addAfter
public void addAfter(net.minecraft.world.item.ItemStack afterLast, Collection<net.minecraft.world.item.ItemStack> newStacks) -
addAfter
public void addAfter(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 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(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 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.isSameItemSameComponents(net.minecraft.world.item.ItemStack, net.minecraft.world.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<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 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
public void addBefore(net.minecraft.world.level.ItemLike beforeFirst, net.minecraft.world.item.ItemStack... newStack) -
addBefore
public void addBefore(net.minecraft.world.item.ItemStack beforeFirst, net.minecraft.world.item.ItemStack... newStack) -
addBefore
public void addBefore(net.minecraft.world.level.ItemLike beforeFirst, net.minecraft.world.level.ItemLike... newItem) -
addBefore
public void addBefore(net.minecraft.world.item.ItemStack beforeFirst, net.minecraft.world.level.ItemLike... newItem) -
addBefore
public void addBefore(net.minecraft.world.level.ItemLike beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks) -
addBefore
public void addBefore(net.minecraft.world.item.ItemStack beforeFirst, Collection<net.minecraft.world.item.ItemStack> newStacks) -
addBefore
public void addBefore(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 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(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 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.isSameItemSameComponents(net.minecraft.world.item.ItemStack, net.minecraft.world.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<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 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.
-