Reputation: 1
I tried to create a method to conveniently register new items but when I pass itemGroup
to ItemGroupEvents.modifyEntriesEvent the program throws an error: 'modifyEntriesEvent(net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>)' in 'net.fabricmc.fabric .api.itemgroup.v1.ItemGroupEvents' cannot be applied to '(net.minecraft.item.ItemGroup)'
Code:
private static Item registerItem(String id, Item item, ItemGroup itemGroup) {
Item returnItem = Registry.register(Registries.ITEM, new Identifier(GoIgratiMod.MOD_ID, id), item);
ItemGroupEvents.modifyEntriesEvent(itemGroup).register(entries -> entries.add(returnItem));
return returnItem;
}
I tried to find information on the Internet, but ready-made groups like ItemGroups.MISC were used everywhere
Upvotes: 0
Views: 793
Reputation: 1
I fixed this error... Replacing "ItemGroup" on "RegistryKey<ItemGroup>" on 1 line
Upvotes: 0