Jump to content

[1.9] [SOLVED] Strange bug rendering TileEntitySpecialRenderer


lizardman

Recommended Posts

Hey all, first time poster. I'm just learning how to use Forge, so I'm trying to make a chest clone. I've copied over most of the Chest's code, with a bit of my own -- it's meant to ALWAYS be a double chest that can only store a certain type of item. So far, it works great - reliably creates the second dummy block, synchronized inventory between blocks, etc. But, when rendering it, the block renders off of the player's position rather than its own - causing it to (rather humorously) follow the player. Below is my code:

 

Chest Block

Tile Entity

Tile Entity Renderer

 

Frankly, I'm stumped. I'm fairly confident the root of the problem is in one of these three classes, but if need be I can provide the rest related to it. Any advice?

Link to comment
Share on other sites

I can see a few mistakes, and for the block moving with you, if you look in the TileEntityChestRenderer it has a few lines that you don't have which are:

 

 

            GlStateManager.pushMatrix();

            GlStateManager.enableRescaleNormal();

            GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F);

            GlStateManager.scale(1.0F, -1.0F, -1.0F);

            GlStateManager.translate(0.5F, 0.5F, 0.5F);

 

 

which is put before the rotation.

Link to comment
Share on other sites

Your renderer should be spamming your log with GL errors because you are only doing a pushMatrix if the block is getting hit/destroyed. I would suggest you to try to understand the chest renderer and rewrite it for your needs. This code contains some stuff which is (from my limited knowledge) unneeded.

Link to comment
Share on other sites

I can see a few mistakes, and for the block moving with you, if you look in the TileEntityChestRenderer it has a few lines that you don't have which are:

 

 

            GlStateManager.pushMatrix();

            GlStateManager.enableRescaleNormal();

            GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F);

            GlStateManager.scale(1.0F, -1.0F, -1.0F);

            GlStateManager.translate(0.5F, 0.5F, 0.5F);

 

 

which is put before the rotation.

 

Tried this, and it worked like a charm! Now I guess it's time to find out why that works so this doesn't happen again. Thanks!

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.

Announcements



×
×
  • Create New...

Important Information

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