Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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";

}

 

}

  • 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...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.