Jump to content

Recommended Posts

Posted

Hi,

 

I have an Item (a projectile launcher) that looks perfect when rendered in in the Player's hand but points the wrong way when rendered in the Player's inventory. Is there a way to rotate a texture, but only in the inventory?

 

Thanks!

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

Where would I put glRotatef? Also, is there a way to use vanilla rendering in the IItemRenderer instead of using the Tessellator?

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

I have a problem now. It renders correctly in the inventory, but often has a weird colored background. Any ideas how to fix this?

 

Here is my Item Renderer code:

public class ItemRendererCannon implements IItemRenderer{

public static RenderItem renderitem = new RenderItem();

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch (type) {
	case EQUIPPED:
		return false;
	case EQUIPPED_FIRST_PERSON:
		return false;
	case ENTITY:
		return false;
	case INVENTORY:
		return true;
	default:
		return false;
	}
}

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

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	switch(type){
	case EQUIPPED:
		break;
	case EQUIPPED_FIRST_PERSON:
		break;
	case ENTITY:
		break;
	case INVENTORY:
		Draw2D(item);
		break;
	default:
		break;
	}

}

public void Draw2D(ItemStack item){
    IIcon icon = item.getItem().getIcon(item, 0);

	Tessellator tessellator = Tessellator.instance;		
    tessellator.startDrawingQuads();
    
    double minU1 = (double)icon.getMinU();
    double minV1 = (double)icon.getMinV();
    double maxU1 = (double)icon.getMaxU();
    double maxV1 = (double)icon.getMaxV();

    tessellator.addVertexWithUV(16.0, 16.0, 0.0, minU1, maxV1);
    tessellator.addVertexWithUV(16.0,  0.0, 0.0, maxU1, maxV1);
    tessellator.addVertexWithUV( 0.0,  0.0, 0.0, maxU1, minV1);
    tessellator.addVertexWithUV( 0.0, 16.0, 0.0, minU1, minV1);
    	    
    tessellator.draw();
}

}

 

There is a screenshot at https://cloud.githubusercontent.com/assets/6693944/4097725/b5ba9626-2fe0-11e4-91e3-952fcab11ca9.png

Note the colored background of the items in the hotbar. Any idea how to fix this? It it caused by messing with the image vertices?

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

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.