summaryrefslogtreecommitdiff
path: root/src/main/java/lance5057/tDefense/armor/modifiers/modifierProtection.java
blob: 2e23b79800b6136b4d032fe9897ed6cb474c9699 (plain)
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
92
93
94
95
//package lance5057.tDefense.armor.modifiers;
//
//import java.util.Arrays;
//import java.util.List;
//
//import net.minecraft.item.ItemStack;
//import net.minecraft.nbt.NBTTagCompound;
//import tconstruct.library.tools.ToolCore;
//import tconstruct.modifiers.tools.ModInteger;
//
//public class modifierProtection extends ModInteger
//{
//	String		color;
//	String		type;
//	String		tooltipName	= "";
//	int			initialIncrease;
//	int			secondaryIncrease;
//	String[]	types		= {"Protection", "Fire Protection", "Blast Protection", "Projectile Protection", "Featherfall"};
//
//	public modifierProtection(ItemStack[] items, int effect, int increase, String c, String t)
//	{
//		super(items, effect, t, increase, c, t);
//		color = c;
//		type = t;
//		initialIncrease = secondaryIncrease = increase;
//	}
//
//	@Override
//	protected boolean canModify(ItemStack tool, ItemStack[] input)
//	{
//		if(tool.getItem() instanceof ToolCore)
//		{
//			final List list = Arrays.asList(((ToolCore) tool.getItem()).getTraits());
//			final NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
//
//			if(list.contains("heavyarmor") || list.contains("lightarmor"))
//			{
//				if(type != types[4])
//				{
//					for(int i = 0; i < 4; i++)
//					{
//						if(tags.hasKey(types[i]))
//						{
//							if(types[i] != type)
//							{
//								return false;
//							}
//							if(types[i] == type && tags.getInteger(types[i]) > 5)
//							{
//								return false;
//							}
//						}
//					}
//					return true;
//				}
//				else if(type == types[4] && tags.getInteger(types[4]) < 5)
//				{
//					if(list.contains("feet"))
//					{
//						return true;
//					}
//					return false;
//				}
//			}
//
//		}
//		return false;
//	}
//
//	@Override
//	public void modify(ItemStack[] input, ItemStack tool)
//	{
//		final NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
//		if(tags.hasKey(key))
//		{
//			int increase = tags.getInteger(key);
//			increase += secondaryIncrease;
//			tags.setInteger(key, increase);
//		}
//		else
//		{
//			tags.setInteger(key, initialIncrease);
//		}
//
//		int modifiers = tags.getInteger("Modifiers");
//		modifiers -= 1;
//		tags.setInteger("Modifiers", modifiers);
//
//		int prot = tags.getInteger(type);
//		prot += 1;
//		tags.setInteger(type, prot);
//
//		addToolTip(tool, color + tooltipName, color + key);
//	}
//}