Jump to content

[1.13.2] replacing block.getActualState()


anothertime

Recommended Posts

In 1.12 I was using block.getActualState() to activate "cosmetic-only" properties in one of my blocks. Basically, the block change texture (choosing from 5 different ones) depending on a values stored by the block tile entity. The on-disk metadata of that block was always zero

 

In 1.13 getActualState is gone: should I actualy change the blockstate of the block every time the value in the TE change (causing chunk updates on the server for no reasons) or is there any other way to do so? I known extended block states exist but I don't understand how to use then with my blockstate jsons

 

thank you guys!
 

Link to comment
Share on other sites

Yeah I noticed that. I was looking into extended states but from what I understand I can only work with unlisted properties in extended states, that is, properties that are not in the block json blockstate file. Unless I'm wrong :)

 

In my blockstate I have a TYPE property with values between 0 (default/black texture) and 4 (red texture), the color to use is stored in the block TE.

 

In 1.12.2 my getMetaFromState() always returned 0 (so TYPE=0), leaving getActualState() to set TYPE to the color stored by the TE

 

Can I do this with extended states?

 

Thank you!

Link to comment
Share on other sites

I'm sorry, I know that my property name is a bit misleading. Those  are not 5 different blocks, it's basically a chest that show how full it is by changing it's texture. The TE compute the value for the TYPE property (0/black = empty, 4/red = full, and values in between) and my old getActualState() return the corresponding value for the blockstate json property. Could this be done using extended state and my current blockstate json or should I call world.setBlockState() every time the amount of stuff in the chest change between one TYPE and the other?

 

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.