Kant0sh Posted August 18, 2014 Share Posted August 18, 2014 I want to create an item that has a very specific part colored by code, a bit like dyed leather armor, using a greyscale texture for coloring in, and an overlay with permanent colors. I got the basic multilayering done using two render passes, but the coloring is off when the item is held in the players hand, 3rd and 1st person... it's basically the wrong way around any advice would be much appreciated! Thanks Screenshot : http://i.imgur.com/sYUfUsB.png Item class : package mod3DPrinter.item; import mod3DPrinter.mod.Mod3DPrinter; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class FilamentItem extends DefaultItem { private IIcon[] icons; private String regname; private int color; private int c; public FilamentItem(String regname) { super(Mod3DPrinter.printerTab); this.regname = regname; this.color = 0xffffff; this.c = 0; } @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { return color; } @Override @SideOnly(Side.CLIENT) public boolean requiresMultipleRenderPasses() { return true; } @Override public int getRenderPasses(int meta){ return 2; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[2]; icons[0] = iconRegister.registerIcon(Mod3DPrinter.MODID + ":" + regname); icons[1] = iconRegister.registerIcon(Mod3DPrinter.MODID + ":" + regname + "_overlay"); } @Override public IIcon getIcon(ItemStack itemStack, int renderPass) { if(renderPass == 0){ color = 0xff0000; }else{ color = 0xffffff; } return icons[renderPass]; } } Quote Thanks for helping me <3 Link to comment Share on other sites More sharing options...
TheGreyGhost Posted August 18, 2014 Share Posted August 18, 2014 Hi I don't know why your rendering is swapping the colours around in different views. I'd suggest that you can fix it by using an IItemRenderer. It's a bit more effort but gives you a lot more control over rendering in different views. A quick google should show up several tutorials on it. -TGG Quote Link to comment Share on other sites More sharing options...
Kant0sh Posted August 18, 2014 Author Share Posted August 18, 2014 Thanks for your help, but i just got it to work the way i wanted it to looked at the code of pahimar's ee3 and sorted out that the int parameter passed to the getColor method is the renderPass.... so all done now Quote Thanks for helping me <3 Link to comment Share on other sites More sharing options...
Recommended Posts
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.