Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Your First Item: "NullPointerException: Item id not set" in Minecraft 1.21.2 and onward #216

Open
valentinegb opened this issue Nov 19, 2024 · 3 comments
Labels
correction Something isn't right on a page

Comments

@valentinegb
Copy link

Following the Creating Your First Item guide as it is now, results in the following error:

NullPointerException: Item id not set

According to the blog post Fabric for Minecraft 1.21.2, this can be resolved by manually setting registry keys. Here's the example in the blog post:

Identifier id = Identifier.of("mymod", "test_item");
RegistryKey<Item> key = RegistryKey.of(RegistryKeys.ITEM, id);

Item.Settings settings = new Item.Settings()
    // If your item is based on a block
    .useBlockPrefixedTranslationKey()
    .registryKey(key);

Registry.register(Registries.ITEM, key, new Item(settings));
@valentinegb valentinegb changed the title Creating Your First Item: 'NullPointerException: Item id not set Creating Your First Item: "NullPointerException: Item id not set" in Minecraft 1.21.2 Nov 19, 2024
@valentinegb valentinegb changed the title Creating Your First Item: "NullPointerException: Item id not set" in Minecraft 1.21.2 Creating Your First Item: "NullPointerException: Item id not set" in Minecraft 1.21.2 and onward Nov 19, 2024
@its-miroma its-miroma added the correction Something isn't right on a page label Nov 19, 2024
@its-miroma
Copy link
Member

The current guide is for Minecraft 1.21.1, please track the update to 1.21.3 in #206

@valentinegb
Copy link
Author

Should I close this issue too?

@its-miroma
Copy link
Member

You may leave it to remind us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
correction Something isn't right on a page
Projects
None yet
Development

No branches or pull requests

2 participants