Jump to content

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


Recommended Posts

Posted

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.

Posted

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

 

 

 

 

Posted

Thanks so much Grey Ghost. I am going to give this a shot! I appreciate the link to your mod, where I can see the Reflection Example. I'll let you know how it goes. :)

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello , when I try to launch the forge installer it just crash with a message for 0,5 secondes. I'm using java 17 to launch it. Here's the link of the error :https://cdn.corenexis.com/view/?img=d/ma24/qs7u4U.jpg  
    • You will find the crash-report or log in your minecraft directory (crash-report or logs folder)
    • Use a modpack which is using these 2 mods as working base:   https://www.curseforge.com/minecraft/modpacks/life-in-the-village-3
    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.