Fixed ItemRenderer not grabbing custom texture files properly for block items

This commit is contained in:
LexManos 2012-08-12 20:40:04 -07:00
parent bef0090af0
commit 83f7a57199

View file

@ -20,6 +20,9 @@
- Block var4 = Block.blocksList[par2ItemStack.itemID];
-
- if (var4 != null && RenderBlocks.renderItemIn3d(var4.getRenderType()))
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
- this.renderBlocksInstance.renderBlockAsItem(var4, par2ItemStack.getItemDamage(), 1.0F);
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED);
+
+ if (customRenderer != null)
@ -28,9 +31,8 @@
+ ForgeHooksClient.renderEquippedItem(customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack);
+ }
+ else if (par2ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
- this.renderBlocksInstance.renderBlockAsItem(var4, par2ItemStack.getItemDamage(), 1.0F);
+ {
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
+ this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
}
else