Skip to content

Dependent on exactly what you want to do you have access to 2 function RegisterBlock and RegisterItemlessBlock.

Methods

RegisterBlock(String name, String Modid, Supplier aNew, Item.Settings settings)

1.0.0 1.19.2 yarn Setup Required

This method Register's a block and an item for that block. Based on the mod loader. it either returns the Object itself or a RegistryObject of the Object.

Parameters:

  • name: The Block name (ID).
  • Modid: The Mod ID of the registrar.
  • aNew: The supplier that provides the Block instance.
  • settings: The settings for the Block's inventory item.

Returns: The registered data.

Example: Itemized Block

Registry.RegisterBlock("ruby", "my_modid", ()->new Block(), new Item.Settings());

RegisterItemlessBlock(String name, String Modid, Supplier aNew)

1.0.0 1.19.2 yarn Setup Required

This method just Register's a block . Based on the mod loader. it either returns the Object itself or a RegistryObject of the Object.

Parameters:

  • name: The Block name (ID).
  • Modid: The Mod ID of the registrar.
  • aNew: The supplier that provides the Block instance.

Returns: The registered data.

Example: Block

Registry.RegisterItemlessBlock("ruby", "my_modid", ()->new Block());