Posted June 18, 201510 yr Greetings fellow modders, I am working on a mod that is going to add a ton of armor into the game, currently its only for 1.7.10 but I'll update it to 1.8 once it is completely finished. So my question is I want to add health to the player when they equip a set of armor, I have the full set in one class(I can divy it up into multiple classes if I have to but I would rather not) I just don't know the code or what I need to do to add that on to my armor. Heres the code for the stone armor, and say i wanted to add an extra 2 hearts of health to the bar, how would i go about that? package slaughterfactory.kingsadventure.item; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import slaughterfactory.kingsadventure.KingsAdventure; public class ItemStoneArmor extends ItemArmor { public ItemStoneArmor(ArmorMaterial armorMaterial, int renderIndex, int armorType) { super(armorMaterial, renderIndex, armorType); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if(this.armorType == 2) { return "ka:textures/models/armor/stone_layer_2.png"; } return "ka:textures/models/armor/stone_layer_1.png"; } }
June 18, 201510 yr Author Sorry, Im a bit new to coding this, I am unsure of where I would put something like that or what the code would actually look like. I've tried looking around and it seems like most everyone is doing it for mobs and not for armor so I am unsure what to do...
June 18, 201510 yr Author Yup I have been overriding the method but its still coming up with errors in my armor class.
June 18, 201510 yr Author Thanks for being an ass =D and again its not letting me override anything what so ever so thanks but i found the help i needed on another forum.
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.