类 BuildCreativeModeTabContentsEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent
- 所有已实现的接口:
CreativeModeTab.Output
,net.neoforged.fml.event.IModBusEvent
public final class BuildCreativeModeTabContentsEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.fml.event.IModBusEvent, CreativeModeTab.Output
Fired when the contents of a specific creative mode tab are being populated in
CreativeModeTab.buildContents(CreativeModeTab.ItemDisplayParameters)
.
This event may be fired multiple times if the operator status of the local player or enabled feature flags changes.
In vanilla, this is only fired on the logical client, but mods may request creative mode tab contents on the server.
-
字段概要
字段修饰符和类型字段说明private final CreativeModeTab.ItemDisplayParameters
private final InsertableLinkedOpenCustomHashSet
<ItemStack> private final InsertableLinkedOpenCustomHashSet
<ItemStack> private final CreativeModeTab
private final ResourceKey
<CreativeModeTab> -
构造器概要
构造器构造器说明BuildCreativeModeTabContentsEvent
(CreativeModeTab tab, ResourceKey<CreativeModeTab> tabKey, CreativeModeTab.ItemDisplayParameters parameters, InsertableLinkedOpenCustomHashSet<ItemStack> parentEntries, InsertableLinkedOpenCustomHashSet<ItemStack> searchEntries) -
方法概要
修饰符和类型方法说明void
accept
(ItemStack newEntry, CreativeModeTab.TabVisibility visibility) Inserts the new stack at the end of the given tab at this point in time.private void
assertNewEntryDoesNotAlreadyExists
(InsertableLinkedOpenCustomHashSet<ItemStack> setToCheck, ItemStack newEntry) private static void
assertStackCount
(ItemStack newEntry) private void
assertTargetExists
(InsertableLinkedOpenCustomHashSet<ItemStack> setToCheck, ItemStack existingEntry) getFlags()
it.unimi.dsi.fastutil.objects.ObjectSortedSet
<ItemStack> The current immutable ordered set of the parent tab entries in the order to be added to the Creative Menu.it.unimi.dsi.fastutil.objects.ObjectSortedSet
<ItemStack> The current immutable ordered set of the search tab entries in the order to be added to the Creative Menu.getTab()
返回 the creative mode tab currently populating its contents。返回 the key of the creative mode tab currently populating its contents。boolean
void
insertAfter
(ItemStack existingEntry, ItemStack newEntry, CreativeModeTab.TabVisibility visibility) Inserts the new entry after the specified existing entry.void
insertBefore
(ItemStack existingEntry, ItemStack newEntry, CreativeModeTab.TabVisibility visibility) Inserts the new entry before the specified existing entry.void
insertFirst
(ItemStack newEntry, CreativeModeTab.TabVisibility visibility) Inserts the new entry in the front of the tab's content.(专用程序包) static boolean
isParentTab
(CreativeModeTab.TabVisibility visibility) (专用程序包) static boolean
isSearchTab
(CreativeModeTab.TabVisibility visibility) void
remove
(ItemStack existingEntry, CreativeModeTab.TabVisibility visibility) Removes an entry from the tab's content.
-
字段详细资料
-
tab
-
parameters
-
parentEntries
-
searchEntries
-
tabKey
-
-
构造器详细资料
-
BuildCreativeModeTabContentsEvent
@Internal public BuildCreativeModeTabContentsEvent(CreativeModeTab tab, ResourceKey<CreativeModeTab> tabKey, CreativeModeTab.ItemDisplayParameters parameters, InsertableLinkedOpenCustomHashSet<ItemStack> parentEntries, InsertableLinkedOpenCustomHashSet<ItemStack> searchEntries)
-
-
方法详细资料
-
getTab
返回 the creative mode tab currently populating its contents。- 返回:
- the creative mode tab currently populating its contents
-
getTabKey
返回 the key of the creative mode tab currently populating its contents。- 返回:
- the key of the creative mode tab currently populating its contents
-
getFlags
-
getParameters
-
hasPermissions
public boolean hasPermissions() -
getParentEntries
The current immutable ordered set of the parent tab entries in the order to be added to the Creative Menu. Purely for querying to see what in it. Please use the other event methods for modifications. -
getSearchEntries
The current immutable ordered set of the search tab entries in the order to be added to the Creative Menu. Purely for querying to see what in it. Please use the other event methods for modifications. -
accept
Inserts the new stack at the end of the given tab at this point in time.- 指定者:
accept
在接口中CreativeModeTab.Output
- 抛出:
IllegalArgumentException
- if the new itemstack's count is not 1 or entry already was added to the tab previously.
-
insertAfter
public void insertAfter(ItemStack existingEntry, ItemStack newEntry, CreativeModeTab.TabVisibility visibility) Inserts the new entry after the specified existing entry.- 抛出:
IllegalArgumentException
- if the new itemstack's count is not 1 or target does not exist in set OR if the existing entry is not found in the tab's lists.
-
insertBefore
public void insertBefore(ItemStack existingEntry, ItemStack newEntry, CreativeModeTab.TabVisibility visibility) Inserts the new entry before the specified existing entry.- 抛出:
IllegalArgumentException
- if the new itemstack's count is not 1 or target does not exist in set OR if the existing entry is not found in the tab's lists.
-
insertFirst
Inserts the new entry in the front of the tab's content.- 抛出:
IllegalArgumentException
- if the new itemstack's count is not 1 or entry already was added to the tab previously.
-
remove
Removes an entry from the tab's content. -
isParentTab
-
isSearchTab
-
assertTargetExists
private void assertTargetExists(InsertableLinkedOpenCustomHashSet<ItemStack> setToCheck, ItemStack existingEntry) -
assertNewEntryDoesNotAlreadyExists
private void assertNewEntryDoesNotAlreadyExists(InsertableLinkedOpenCustomHashSet<ItemStack> setToCheck, ItemStack newEntry) -
assertStackCount
-