Posted September 16, 20205 yr Hello! Today, I tried to make some blocks(with item blocks), but this time not with the "old" way which would be to use a register event directly: I wanted to use the deferred registry. But I couldn't get it working right: When I registered an item block (which would eventually call new Block().asItem()), the game said that there would be an duplicate registry entry. Also, I have no idea how to use asItem with an item group. So, it would be great if you could help me. -Budschie
September 17, 20205 yr Author @diesieben07 Ah, ok, thanks. Now I use this code: public static final RegistryObject<BlockItem> TEST_BLOCK = REGISTRY.register("test_block", () -> new BlockItem(BlockInit.TEST_BLOCK.get(), new Item.Properties().group(ItemGroup.COMBAT))); Is this how I should do this? Or should I avoid getting the test block with TEST_BLOCK.get()? Edited September 17, 20205 yr by Budschie
September 17, 20205 yr Yes, this is correct , provided that REGISTRY is a DeferredRegister<Item> and your blockitem registry name matches the registry name of the block it represents...also you can just put your block item into a RegistryObject<Item> Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.