Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

  • Author

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!

  • Author

Never mind I got it to work by messing with vertices.

Check out my mod, Realms of Chaos, here.

 

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

  • Author

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.