Jump to content

How do I get a blockstate from a block?


EOT3000

Recommended Posts

I am trying to get a block state from a block by doing Blocks.HARDENED_STAINED_CLAY.getStateById();. But when I go into the game, I don't get the right block. I figured out that getStateById doesn't work with what I am trying to do. Which method do I use though?

Link to comment
Share on other sites

6 minutes ago, EOT3000 said:

getStateById

This is an internal method for getting the blockstate from an internal ID. Never use anything that involves IDs ever.

 

6 minutes ago, EOT3000 said:

Which method do I use though?

Construct the blockstate yourself with the properties you need.

Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.WHITE)

 

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.

Announcements



×
×
  • Create New...

Important Information

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