Jump to content

Recommended Posts

Posted
17 hours ago, jeffryfisher said:

It's time to set breakpoints in related methods and then step through the breaking of your block in the test case that baffles you.

At this point I already managed to get getActuallState to work (I said it a few posts above).

So now getActualState method is called and the correct value is returned. But the model of block isn't changing until I'll force a block update. If I'll try to break block, it will emit particles with the correct texture.

So the game just doesn't want to.. redraw block?

Posted

The chunk will redraw any time the state saved to metadata changes, but not when the actual state changes (because the actual state could change at any time). You need to call World#notifyBlockUpdate to trigger a chunk redraw.

 

Since there's no callback for blocks n positions above a block changing, you'll need to periodically check whether the block can see the sky and redraw the chunk if that changes. Since you need to store this somewhere and redraw the chunk when it changes, you may as well store in the metadata rather than setting it from the actual state.

 

Depending on how frequently you want to check this, you can either use a TileEntity that implements ITickable or schedule block updates (override Block#updateTick to perform the check and call World#scheduleUpdate from Block#onBlockAdded and Block#updateTick).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
On 8/1/2017 at 3:59 AM, Choonster said:

or schedule block updates

I still like the randomness of ticking the block like a crop waiting to grow.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.