net.minecraft.client.renderer.ItemModelMesher Java Examples

The following examples show how to use net.minecraft.client.renderer.ItemModelMesher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuiComponentItemStackSpinner.java    From OpenModsLib with MIT License 6 votes vote down vote up
private void renderItem(ItemStack itemStack) {
	parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

	final RenderItem itemRenderer = parent.getItemRenderer();
	final ItemModelMesher itemModelMesher = itemRenderer.getItemModelMesher();
	final IBakedModel model = itemModelMesher.getItemModel(stack);

	GlStateManager.disableLighting();
	GlStateManager.enableRescaleNormal();
	GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
	GlStateManager.enableBlend();
	GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
	GlStateManager.pushMatrix();
	itemRenderer.renderItem(stack, model);
	GlStateManager.cullFace(CullFace.BACK);
	GlStateManager.popMatrix();
	GlStateManager.disableRescaleNormal();
	GlStateManager.disableBlend();

	GlStateManager.enableLighting();
}
 
Example #2
Source File: OpenClientProxy.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void bindItemModelToItemMeta(Item item, int metadata, ResourceLocation model) {
	final ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
	mesher.register(item, metadata, new ModelResourceLocation(model, "inventory"));
}