Jump to content

Show how many blocks in loaded chunks


CSKLego

Recommended Posts

Hopefully you get the just of it in the title, but I'd like for a mod that displays all the blocks currently in the loaded chunks.
Like 5000 dirt, 25000 stone... etc etc
I don't know if there is anything like that already created, or if writing one would be rather simple...
Not much experience modding, but maybe a little guidance would help get me started if anything

<3

Link to comment
Share on other sites

5 hours ago, CSKLego said:

Hopefully you get the just of it in the title, but I'd like for a mod that displays all the blocks currently in the loaded chunks.
Like 5000 dirt, 25000 stone... etc etc
I don't know if there is anything like that already created, or if writing one would be rather simple...
Not much experience modding, but maybe a little guidance would help get me started if anything

<3

create a gui and go through the clients world's loaded chunks array then for each type of block increment one and then display then as icons in a scroll bar gui. Make sure it's not an air block

It's up to you if you want live updates or do you have to reopen the gui/refresh button since live every tick is laggy

Edited by jredfox
Link to comment
Share on other sites

The problem is that performance is going to be an issue. A single chunk has 65k positions you need to check, so 20 chunks has over a million positions! Functions that need to consider lots of blocks like rendering the world have very sophisticated ways -- like caching, culling and frustum checking --  to keep the processing work manageable.

 

I think your best hope is to scan chunks as they are loaded and remember it. Even that will give a bit of a performance hit but at least it will be spread out and will only have to be done once. After the initial block counting, you'll also have to handle events for blocks breaking and blocks being placed/changed to keep your counts up to date. 

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

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.



×
×
  • Create New...

Important Information

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