Jump to content

Recommended Posts

Posted

I'm playing around with block tinting and have it working well -- and to test it I had a custom terrain block which I could randomly color. (It's actually pretty trippy). However, with a random color being returned by my getColorMultiplier() override I'm wondering how often it is called -- since I have random value returned, will it get called again (like maybe when loading a chunk, or when checking for neighbor block state changes or something).

 

What's weird is the call hierarchy for getColorMultiplier() shows it is called by the BlockModelRenderer in several places like render quads methods. But the colors are staying steady so it is obviously only being called once rather than recalculated every render refresh.

 

So when is the tint actually being set (reset)? And conversely if I wanted it to be recalculated what would I call?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted (edited)

Whenever the chunk needs a rerender.

 

Note that I don't mean a render frame, but when the chunk "model" itself is out of date and needs to be refreshed.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
15 minutes ago, Draco18s said:

Whenever the chunk needs a rerender.

 

Note that I don't mean a render frame, but when the chunk "model" itself is out of date and needs to be refreshed.

Okay, that makes sense and is consistent with what I'm seeing. But what triggers a chunk re-render? Playing around I see that placing a block will trigger it (makes sense), but I also see occasional changes triggered by other things. Maybe it is blocks that random tick? Or some other lighting updates? Also it seems (again makes sense) that it recolors every time you load the saved world since the colors are not persistent across saves.

 

I guess I'm mainly looking for a solid way to force the update. I could do something like replacing a block, but wondering if there is a more direct way. 

 

Looking at the call hierarchy there is a rebuildChunk() in the ChunkRenderer. It is a bit hard to fully trace after that because it then has a Runnable for a render thread (I guess). It is also called though by RenderGlobal.updateChunks() as well as RenderGlobal.setupTerrrain() which are both called by EntityRenderer.renderWorld().  There is a check for RenderChunk.needsImmediateUpdate() so I'll see if I can force that probably with forcing a notify block update.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
31 minutes ago, jabelar said:

But what triggers a chunk re-render?

Any block update that also tells the client to re-render the block (not all block updates do)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Cool, yeah I got it to work. I was able to tint an area under the players that gets updated as they move around. I found the most trustworthy way was to replace a block in place (basically set to air and back again). The other set block and set notify all had not as good behavior -- some complained about concurrent modification, some updated but not entirely smoothly/consistently.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.