Replies: 1 comment
-
You can use the private static final ItemGroup ITEM_GROUP = FabricItemGroup.builder()
.icon(() -> new ItemStack(CUSTOM_ITEM))
.displayName(Text.translatable("itemGroup.tutorial.test_group"))
.entries((context, entries) -> {
entries.add(CUSTOM_ITEM);
})
.build(); I have updated the wiki page accordingly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In https://fabricmc.net/wiki/tutorial:itemgroup , you can see these code
ItemGroupEvents.modifyEntriesEvent(ITEM_GROUP).register(content -> { content.add(CUSTOM_ITEM); });
It's in order to add an item into the itemgroup.
But in fact, when I copy those code into Idea , I got This Wrong
`Required type:
RegistryKey
<net. minecraft. item. ItemGroup>
Types provided:
ItemGroup`
It seems that , the parameter CUSTOM_ITEM that programmer has defined is not of the same type as Minecraft's ItemGroup like "ItemGroups.TOOLS" or "ItemGroups.BLOCKS".
CUSTOM_ITEM is a type of "ItemGroup" and the other is a type of "RegistryKey".
I has tried to understand how the wiki is different form my code,but I found that it seems just a bug of Fabric(1.20.2) or a wrong of the wiki.
Haha, I'm just a noob in fabric, so if there is any negligence on my part, please don't be too harsh on me, let's progress together with Fabric!
I don't use Github very often, so if you want to contact me, you can send me an email: chier@aliyun.com
Beta Was this translation helpful? Give feedback.
All reactions