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

Does your block need to animate?

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.

You could render the block as a baked model (which includes items, AFAIK) which would reduce the lag significantly as the quads only get "rendered" once, rather than every frame.

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.

Hi

 

If you're happy with a 2D appearance for your items (i.e. no thickness) you can render the items to a frame buffer object, then use that as the texture for the inside of the cabinet.  i.e. your cabinet has a single quad inside which uses the prerendered texture.  That is much faster than rendering all the quads for the all the items, and you only need to update it once, when the items inside the cabinet change.

 

Draco's idea might be plenty fast enough, try that first I think.

 

-TGG

Hi

 

That sounds good, unfortunately I've never used that before, would I handle this in the block class?

No, I think the best place would be in the TileEntitySpecialRenderer (you are using a TileEntity to store the information about the Items, yeah?).

 

When the TESR is called, you check to see whether the items is the same as the last time you rendered.

If not, you draw the items to a FrameBuffer object, cache it for next time, and use it as a texture to render a quad inside your chest.  MapItemRenderer can give you some clues (it creates a texture with code and then binds the texture before rendering the map), also this code for 1.8 which gives clues on how to render to a FrameBuffer and then use that as a texture for rendering:

https://github.com/TheGreyGhost/SpeedyTools/blob/master/src/main/java/speedytools/clientside/selections/SelectionBlockTextures.java

 

But I should warn you it's fairly heavy going, there are quite a few unusual concepts you'd have to master (if you haven't already) and troubleshooting is very painful because it's hard to tell whether your code is working or not (i.e. it either works perfectly, or you get a black texture with no other symptoms at all).

 

-TGG

 

 

 

 

 

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.