Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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

Posted

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

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