Jump to content

[SOLVED] Proper way to register blocks (with subblocks)?


Nuparu00

Recommended Posts

Hello.
I've used to be modding on 1.8.9 some time ago and I've finally decided to update my mod to some more recent version.
I have successfully created some items, some blocks, and actually even converted my IEEP to the capability system, some WorldSavedData stuff, however, I have got a hard time now with a block, that has variants.

This block is pretty much like a vanilla stone (literally, as it is a rock :D ). I have without any problems created the block itself with variants but have problems with the ItemBlocks.

I want to list all variants in the creative tab and I do so by overriding Block#getSubBlocks() as in older versions.
This adds more items to the creative tab BUT they have the same ID (without any metadata) as the original one and do not have any model or texture. After some research I have found out that ItemBlocks are not registered automatically anymore, so I've created my own class extending ItemBlock, registered it and the models.
This makes the items have a model, but it is not corresponding the BlockState and still, it has the default ID.
After some more messing with the code I have even managed it to show to correct ID - but still, it places the default block.

 

Also , here is my code:

Block

ItemBlock

Registring the block

Edited by Nuparu00
Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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