Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Good day,

 

I've recently hit a wall playing around with the rendering hooks: 
Suppose you have a fairly large (~500) collection of BlockStates and want to render them as a preview in the client world only - calling

BlockRendererDispatcher.renderBlock(IBlockState, BlockPos, IBlockAccess, BufferBuilder)

this many times during a

RenderWorldLastEvent

works in a way, but doesn't seem like the way to go, especially concerning optimization. 
I've had a look at some alternatives, those used by the mod Schematica for instance. However before I look into extending from RenderGlobal with my limited understanding of the engine itself,

I was interested in whether I've missed any obvious / recommended ways to go about this, as I am sure this has been done many times before. ?


Any suggestions are welcome, thanks for your time.~

Edited by simicats

You can cache the BufferBuilder results by doing the same thing that RenderChunk does. I’ll write you some example code in a bit because it’s relatively complicated and I have lots of experience but the basic idea is:

1) Render your data to your own BufferBuilder

2) Render your BufferBuilder from the event

3) Update the BufferBuilder when your data changes 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • Author

Hello Cadiboo and thanks for your response, I'm glad to have found an expert on the matter. =]

Caching a BufferBuilder sounds very reasonable, if you feel like leaving some code / reference: I'd be most interested in the general life cycle of said Buffer, from the size on creation to the render call in the event. 

Ideally you would do the block rebuilding off-thread or even multithreaded. I haven't done that in this example though.

https://gist.github.com/Cadiboo/753607e41ca4e2ca9e0ce3b928bab5ef

If you do multi-thread/off-thread your rebuilding, you will need to have proper thread safe code.

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.