Jump to content

Recommended Posts

Posted

While modding I learned how to register Items and I could not figure out how to register blocks. I try the same method as I did with my items but when I try to /give myself the block, it states it does not exist while the items do.

 

Code for registering Items:

 

@SubscribeEvent
    public void registerItems(RegistryEvent.Register<Item>event) {
        final IForgeRegistry<Item> registry = event.getRegistry();
        registry.register(digging_hoe);
        registry.register(hells_scream);
    }

 

OR

@SubscribeEvent
    public void registerItems(RegistryEvent.Register<Item>event) {
        event.getRegistry().registerAll(digging_hoe, hells_scream);
    }

Code for registering Blocks:

 

@SubscribeEvent
    public void registerBlocks(final RegistryEvent.Register<Block>event) {
        final IForgeRegistry<Block> registry = event.getRegistry();
        registry.register(adobe);
    }

 

OR

@SubscribeEvent
    public void registerBlocks(final RegistryEvent.Register<Block>event) {
        event.getRegistry().registerAll(adobe);
    }

 

Any help in registering blocks would be great! I tried to look for a response on other threads but they did not make sense to me. I would also be grateful on an explanation on why another method could be used. Thanks!

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.