Jump to content

[1.16.2] Handling block items with Deferred Registry


Recommended Posts

Posted

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

Posted (edited)

@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 by Budschie

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.