Skip to content

Items API#67

Merged
SpaceWalkerRS merged 1 commit into
gen2from
items
Jun 25, 2026
Merged

Items API#67
SpaceWalkerRS merged 1 commit into
gen2from
items

Conversation

@SpaceWalkerRS

Copy link
Copy Markdown
Member

The purpose of this API is to provide a hook for registering items.

Features

Item Registration

The REGISTER_ITEMS event is invoked right after Vanilla item registration has completed. Custom item registration should be done in a listener to this event.

The ItemRegistry class provides static access to the item registry:

int getId(Item)
NamespacedIdentifier getKey(Item)

Item getItem(int)
Item getItem(NamespacedIdentifier)

Set<NamespacedIdentifier> keySet()

// 17w46a-
Item register(int, NamespacedIdentifier, Item)
// 17w47a+
Item register(NamespacedIdentifier, Item)

1.6 And Below

In Minecraft 1.6.4 and below, there was no item registry. Instead, items were stored in a single array. This API provides its own registry for these versions, and even registers all Vanilla items using the relevant namespaced IDs from 1.7.

@SpaceWalkerRS SpaceWalkerRS merged commit bb757c0 into gen2 Jun 25, 2026
2 checks passed
@SpaceWalkerRS SpaceWalkerRS deleted the items branch June 25, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant