Skip to content

Instantly share code, notes, and snippets.

@Umpaz
Created June 7, 2020 13:57
Show Gist options
  • Save Umpaz/19eefdfbb188ff92219b1c8cde6f9b39 to your computer and use it in GitHub Desktop.
Save Umpaz/19eefdfbb188ff92219b1c8cde6f9b39 to your computer and use it in GitHub Desktop.
@SubscribeEvent
public static void onRegisterItems(final RegistryEvent.Register<Item> event) {
final IForgeRegistry<Item> registry = event.getRegistry();
BlockInit.BLOCKS.getEntries().stream().map(RegistryObject::get).forEach(block -> {
final Item.Properties properties = new Item.Properties().group(ItemGroup.BUILDING_BLOCKS);
final BlockItem blockItem = new BlockItem(block, properties);
blockItem.setRegistryName(block.getRegistryName());
registry.register(blockItem);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment