Posted February 27, 201510 yr So I want to have it where I check to see if a player is wearing a custom armor and if they are the armor uses a different texture then for all other players. I tried this: @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if ((((EntityPlayer)entity).getDisplayName() == "SureShotM")) { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "4" : "3") + ".png"; } else { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png"; } return Texture; } but it doesn't seem to work ~SureShotM/Leo~ gaming coding all around fun!
February 27, 201510 yr First of all use .equals() and not == for comparing String. Second: WHERE YOU DECLARED 'Texture' ????? AS STATIC FIELD??? OR WHERE??? Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
February 27, 201510 yr Author I just searched through all the possible functions and I did run across the UUID, I was debating on using that but this is just a personal mod for a group of friends, so I will most likely use the username, since they wont change theirs ever. I'm debating on adding the names to a config so if they do decide to change there username they can just add the new one to the config. Again this is more of a debate on all of our ends to figure out what we want. Also Texture is being declared like this. public class ArmorMianite extends ItemArmor { public String textureName; public String Texture; public ArmorMianite(String unlocalizedName, ArmorMaterial material, String textureName, int type) { super(material, 0, type); this.textureName = textureName; setUnlocalizedName(unlocalizedName); this.setTextureName(Reference.MOD_ID + ":" + unlocalizedName); this.setCreativeTab(CreativeTabMianite.Mianite_Tab); this.setMaxStackSize(1); } @Override public String getUnlocalizedName() { return String.format("item.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override public String getUnlocalizedName(ItemStack itemStack) { return String.format("item.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); } protected String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if ((((EntityPlayer)entity).isInvisible())) { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "4" : "3") + ".png"; } else { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png"; } return Texture; } Also if we decide to use the username how do I get the username instead of the display name, I am currently using the if player is invisible as a place holder. ~SureShotM/Leo~ gaming coding all around fun!
February 27, 201510 yr Author Okay Thank you Thank you Thank you it is all working perfectly now. ~SureShotM/Leo~ gaming coding all around fun!
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.