Jump to content

How to determine when visible chunks are done downloading/rendering?


Taytay

Recommended Posts

I am quite new to modding, but I promise I am doing my best to find the answer to this question on my own before needing to bug you guys.

Here's my problem: I would like to take some automated screenshots, but only after the client is done downloading and rendering all of the visible chunks around me. To be clearer: When you move to a new area, there is often a bit of lag before those areas are fully drawn in. Is there an easy way to determine when all of the visible chunks are done downloading and rendering?

 

Any help - even wild guesses, would be appreciated at this point.

Link to comment
Share on other sites

Hi

 

It's for sure possible.

For each chunk in range, Vanilla compiles either a display list or a vertex buffer object (depending on the game settings).  It keeps a list of the chunks which have been compiled and a list of the ones which are still outstanding.  A bit of digging through the vanilla code should help you find the list and check whether the chunks you're interested in are still being compiled.  I don't have access to my IDE at the moment, but a good place to start is to put a breakpoint in Block.getRenderLayer() and then see where it was called from; this method is used by the code which compiles the display list / VBO.

 

A couple of things that might make it a bit harder.  The list is probably private, so you will probably need to use Reflection to access it.  Let us know if you need help with that - it's not difficult once you know how; for example here

https://github.com/TheGreyGhost/SpeedyTools/blob/master/src/main/java/speedytools/clientside/userinput/KeyBindingInterceptor.java

eg this one

  private static final Field keyCodeField = ReflectionHelper.findField(KeyBinding.class, "keyCode", "field_74512_d");

 

The second wrinkle is that the compiling of the display lists /VBOs takes place in multiple threads, so if you access the list of chunks being compiled, you have to do it in a thread-safe manner.  The vanilla code should show you how.

 

-TGG

 

 

 

 

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.