jabelar Posted March 25, 2018 Posted March 25, 2018 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? Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Draco18s Posted March 25, 2018 Posted March 25, 2018 (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 March 25, 2018 by Draco18s Quote 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.
jabelar Posted March 25, 2018 Author Posted March 25, 2018 On 3/25/2018 at 5:55 PM, 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. Expand 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. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Draco18s Posted March 25, 2018 Posted March 25, 2018 On 3/25/2018 at 6:30 PM, jabelar said: But what triggers a chunk re-render? Expand Any block update that also tells the client to re-render the block (not all block updates do) Quote 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.
jabelar Posted March 25, 2018 Author Posted March 25, 2018 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. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Recommended Posts
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.