Skip to content

Registry Utils

OliviaTheVampire edited this page Jun 29, 2019 · 3 revisions

RegistryUtils can be used to make registering blocks a lot simpler becaus you don't need to stress with all of the things related to registering a block or an item or a block entity.

Examples

public class RegisteringExamples {

    public static void init() {
        // Would create a basic block with the modid and name you defined and it would be placed into the build blocks creative tab
        RegistryUtils.register(new Block(Block.Settings.of(Material.STONE)), new Identifier("modid", "test_block"), ItemGroup.BUILDING_BLOCKS);
        
        // Would create a basic block with the modid and name you defined but with no item, can only be used through /setblock
        RegistryUtils.registerBlockWithoutItem(new Block(Block.Settings.of(Material.STONE)), new Identifier("modid", "test_block"));
        
        // Would create a basic item with the modid and name you defined and would place it in the misc creative tab, can add more things onto the item settings
        RegistryUtils.registerItem(new Item(new Item.Settings().group(ItemGroup.MISC)), new Identifier("modid", "test_item"));
    }

}
Clone this wiki locally