-
Notifications
You must be signed in to change notification settings - Fork 755
/
ExoArmor.java
91 lines (80 loc) · 2.96 KB
/
ExoArmor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package tconstruct.items.armor;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.DamageSource;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.EnumArmorPart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ExoArmor extends ArmorCore
{
String textureName;
public ExoArmor(EnumArmorPart part, String texture)
{
super(0, part);
this.textureName = texture;
this.setCreativeTab(TConstructRegistry.materialTab);
}
@Override
public void registerIcons (IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_"
+ (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
}
@Override
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
{
return "tinker:textures/armor/" + textureName + "_" + layer + ".png";
}
@Override
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
{
// Deimplemented for now
}
@SideOnly(Side.CLIENT)
public void getSubItems (Item b, CreativeTabs par2CreativeTabs, List par3List)
{
ItemStack armor = new ItemStack(b, 1, 0);
NBTTagCompound baseTag = new NBTTagCompound();
NBTTagList list = new NBTTagList();
NBTTagCompound armorTag = new NBTTagCompound();
armorTag.setInteger("Modifiers", 30);
baseTag.setTag(SET_NAME, armorTag);
armor.setTagCompound(baseTag);
par3List.add(armor);
}
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if (!stack.hasTagCompound())
return;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(SET_NAME);
double protection = tags.getDouble("protection");
if (protection > 0)
list.add("\u00a7aProtection: " + protection + "%");
boolean displayToolTips = true;
int tipNum = 0;
while (displayToolTips)
{
tipNum++;
String tooltip = "Tooltip" + tipNum;
if (tags.hasKey(tooltip))
{
String tipName = tags.getString(tooltip);
if (!tipName.equals(""))
list.add(tipName);
}
else
displayToolTips = false;
}
}
}