-
Notifications
You must be signed in to change notification settings - Fork 755
/
ExoArmor.java
78 lines (67 loc) · 3.39 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
package tconstruct.items.armor;
import java.util.List;
import java.util.UUID;
import com.google.common.collect.Multimap;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.EnumArmorPart;
public class ExoArmor extends ArmorCore
{
String textureName;
protected static final UUID speed = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CF"); //These are temporary. Do not use them in release
protected static final UUID attack = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CE");
protected static final UUID health = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CD");
protected static final UUID knockback = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CC");
public ExoArmor(int id, EnumArmorPart part, String texture)
{
super(id, 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, int layer)
{
return "tinker:textures/armor/" + textureName + "_" + layer + ".png";
}
public void getSubItems (Block b, CreativeTabs par2CreativeTabs, List par3List)
{
ItemStack armor = new ItemStack(b, 1, 0);
NBTTagCompound baseTag = new NBTTagCompound();
NBTTagList list = new NBTTagList();
//list.appendTag(getAttributeTag("generic.attackDamage", "ExoAttack", 10.0, true, knockback));
//list.appendTag(getAttributeTag("generic.movementSpeed", "ExoSpeed", 1.5, false, speed));
//list.appendTag(getAttributeTag("generic.maxHealth", "ExoHealth", 10.0, true, health));
//list.appendTag(getAttributeTag("generic.knockbackResistance", "ExoKnockback", 0.5, false, knockback));
//baseTag.setTag("AttributeModifiers", list);
NBTTagCompound armorTag = new NBTTagCompound();
armorTag.setInteger("Modifiers", 30);
baseTag.setTag(SET_NAME, armorTag);
armor.setTagCompound(baseTag);
par3List.add(armor);
}
private NBTTagCompound getAttributeTag(String attributeType, String modifierName, double amount, boolean flat, UUID uuid)
{
NBTTagCompound knockbackTag = new NBTTagCompound();
knockbackTag.setString("AttributeName", attributeType);
knockbackTag.setString("Name", modifierName);
knockbackTag.setDouble("Amount", amount);
knockbackTag.setInteger("Operation", flat ? 0 : 1);//0 = flat increase, 1 = % increase
knockbackTag.setLong("UUIDMost", uuid.getMostSignificantBits());
knockbackTag.setLong("UUIDLeast", uuid.getLeastSignificantBits());
return knockbackTag;
}
}