Jump to content

Rendering items in hand


Reika

Recommended Posts

I use custom code to render items when held in hand or in the world as an entity, as I use spritesheets rather than individual textures.

This works almost perfectly. The only visible issue is that the in-hand items are oriented incorrectly.

Here is what I mean (stick provided for comparison).

My code:

	if (type == type.EQUIPPED || type == type.EQUIPPED_FIRST_PERSON || type == type.ENTITY) {
		if (type == type.EQUIPPED || type == type.EQUIPPED_FIRST_PERSON) {
			GL11.glTranslatef(0, 1.25F, 0.3125F);
			GL11.glRotatef(60, 0, 1, 0);
			GL11.glRotatef(65, 0, 0, 1);
			GL11.glTranslatef(-0.625F, 0F, 0);
			GL11.glScalef(1.5F, 1.5F, 1.5F);
			GL11.glRotatef(-90, 0, 0, 1);
			GL11.glTranslatef(-1, 0, 0);
			GL11.glTranslatef(0.5F, 0, 0.25F);
			GL11.glRotatef(-10, 0, 1, 0);
			GL11.glTranslatef(-0.125F, -0.125F, 0F);
		}
		else {
			GL11.glTranslatef(-0.5F, 0, 0);
		}
		float thick = 0.0625F;
		ItemRenderer.renderItemIn2D(v5, 0.0625F+0.0625F*col, 0.0625F*row, 0.0625F*col, 0.0625F+0.0625F*row, 256, 256, thick);
	}

 

z9vyYl7.png

9thaulY.png

ZIJyuUL.png

cgq1NN4.png

 

I am not going to split these up, but how do I fix this?

Link to comment
Share on other sites

It kinda looks like the icon has been rotated slightly

If you edit the image file and rotate it to exactly what the stick is, it might work

looking at the icon from 3rd person perspective, in your hand and on the inv bar at the bottom, the icon is slightly off in it's position, so all I can think is to edit the image and rotate it a bit

Link to comment
Share on other sites

It kinda looks like the icon has been rotated slightly

If you edit the image file and rotate it to exactly what the stick is, it might work

looking at the icon from 3rd person perspective, in your hand and on the inv bar at the bottom, the icon is slightly off in it's position, so all I can think is to edit the image and rotate it a bit

No, the images are indentical. This has to do with how the icons are rendered. I obviously have the wrong translations, but have no idea what the right ones are.

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.