Jump to content

Recommended Posts

Posted

Hello, I have made this part in my code and what i just want to do is to rotate the shield upside down while it remains at the same place.

I tried change the angle but it doesnt effect it or effects the way i dont want.

Can anyone help me just to bring the upside down so it will look the right way?

In the photo you can see how it looks.

Thanks

 

if(type == ItemRenderType.EQUIPPED) {

GL11.glPushMatrix();

GL11.glTranslatef(2.5F, 2.5F, 0.5F);

GL11.glRotatef(180.0F, 0.0F, 0.0F, 0.0F);

GL11.glScalef(3.5F,3.5F,2.5F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();

}

 

width=304 height=408http://i91.photobucket.com/albums/k309/oblisgr/icon_zpsc15d1a4b.png[/img]

Posted

This line is doing nothing:

GL11.glRotatef(180.0F, 0.0F, 0.0F, 0.0F);

 

If you want it to actually rotate by 180 degrees you need to specify an axis (hint: make those 0s not be all zero).

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

Yes i understood and fixed that.

Thanks.

 

Another question if you know.

While the shield render just fine when i hold it, when i add it to an npc the shield is not rendering they same way.

Miss something?

 

 

 

public static class ShieldRender implements IItemRenderer {

 

@Override public boolean handleRenderType(ItemStack itemStack, ItemRenderType type) {return true;}

@Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {return true;}

@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

 

IIcon icon = item.getIconIndex();

 

if(type == ItemRenderType.ENTITY) {

GL11.glPushMatrix();

GL11.glTranslatef(0.0F, 0.0F, 0.0F);

GL11.glRotatef(0.0F, 0.0F, 0.0F, 0.0F);

GL11.glScalef(1.2F,1.2F,1.2F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();

}

 

if(type == ItemRenderType.INVENTORY) {

GL11.glPushMatrix();

GL11.glTranslatef(1.1F, -0.3F, 0.0F);

GL11.glRotatef(225.0F, 0.0F, 1.0F, 0.0F);

GL11.glScalef(1.5F,1.5F,1.5F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();

}

 

if(type == ItemRenderType.EQUIPPED) {

GL11.glPushMatrix();

GL11.glTranslatef(2.6F, -1.0F, 1.0F);

GL11.glRotatef(160, 0F, 1F, 0F);

GL11.glScalef(3.5F,3.5F,2.5F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();

}

 

if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) {

GL11.glPushMatrix();

GL11.glTranslatef(3.0F, -14.0F, 10.0F);

GL11.glRotatef(50.0F, 0F, 1F, 0F);

GL11.glScalef(18.0F,18.0F,15.0F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();

}

 

}

 

}

 

 

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.