Posted April 25, 20169 yr My question is pretty simple (I think). I want to drop some armor pieces that are pre-colored ... as they'd look if a player dyed them in game. I've found sites that list the various hex color codes for dyes but so far haven't found any docs or examples on how to apply to leather armor items programatically in a Forge mod. Here's the section of code I need help expanding to make this happen (if it's even possible?): - - - - - - - - - - - - - - - - - - - - - ItemStack bluePants = new ItemStack(Items.leather_leggings, 1); // *** How can I color these pants blue before dropping? *** // event.getEntityLiving().entityDropItem(bluePants, 0); - - - - - - - - - - - - - - - - - - - - - BTW - I tried a few searches here (and general Google search) but so far haven't found an existing thread asking specifically what I'm looking for - but my apologies if this info has already been asked/documented. Either my search strings are using the wrong words or maybe this just isn't possible? Feel free to just send me to a Wiki/Documentation page if one exists ... but thanks in advance for whatever help anyone can provide! GitHub Profile | MinecraftForum.net Profile
April 25, 20169 yr Author That Wiki didn't really help but it could be that I'm just far too "beginner" with MC mod dev to see the connection (?). In any case after more searching the web I eventually found something working. I'm not sure if it's total noob way of doing it but it is working in game now. Here's what I ended up using in case anyone else ever has the same need/question as I did: ItemStack bluePantStack new ItemStack(Items.leather_leggings, 1); ((ItemArmor) bluePantStack .getItem()).setColor(bluePantStack , 2437522); event.getEntityLiving().entityDropItem(bluePantStack , 1); Color codes found here: https://github.com/FallenMoonNetwork/CanaryLib/blob/master/src/main/java/net/canarymod/api/DyeColor.java GitHub Profile | MinecraftForum.net Profile
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.