Added some extra framework for Living Armour.

This commit is contained in:
WayofTime 2016-01-02 17:07:11 -05:00
parent 5273a85711
commit f27ee1aeb4
3 changed files with 58 additions and 5 deletions

View file

@ -1,11 +1,16 @@
package WayofTime.bloodmagic.item.armour;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModItems;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.registry.ModItems;
import com.google.common.collect.Multimap;
public class ItemLivingArmour extends ItemArmor
{
@ -36,9 +41,38 @@ public class ItemLivingArmour extends ItemArmor
}
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(ItemStack stack)
{
if (this == ModItems.livingArmourChest)
{
LivingArmour armour = getLivingArmour(stack);
return armour.getAttributeModifiers();
}
return super.getAttributeModifiers(stack);
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return super.getUnlocalizedName(stack) + names[armorType];
}
public LivingArmour getLivingArmour(ItemStack stack)
{
if (!stack.hasTagCompound())
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
NBTTagCompound livingTag = tag.getCompoundTag(Constants.NBT.LIVING_ARMOUR);
LivingArmour livingArmour = new LivingArmour();
livingArmour.readFromNBT(livingTag);
return livingArmour;
}
}