-
Notifications
You must be signed in to change notification settings - Fork 755
/
ToolMaterial.java
107 lines (89 loc) · 2.86 KB
/
ToolMaterial.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package tconstruct.library.tools;
import net.minecraft.util.StatCollector;
/*
* Dynamic substitute for an enum. It carries a lot of information
*/
public class ToolMaterial
{
// mining level, durability, mining speed, baseDamage, handle modifier,
// Reinforced level, shoddy/spiny level, color/style on name
public final String materialName;
public final String displayName;
public final int harvestLevel;
public final int durability;
public final int miningspeed; // <-- divided by 100
public final int attack;
public final float handleModifier;
public final int reinforced;
public final float stonebound;
public final String tipStyle;
public final String ability;
@Deprecated
public ToolMaterial(String name, String displayName, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
{
this(name, level, durability, speed, damage, handle, reinforced, stonebound, style, ability);
}
public ToolMaterial(String name, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
{
this.materialName = name;
this.displayName = prefixName();
this.harvestLevel = level;
this.durability = durability;
this.miningspeed = speed;
this.attack = damage;
this.handleModifier = handle;
this.reinforced = reinforced;
this.stonebound = stonebound;
this.tipStyle = style;
this.ability = ability;
}
public String name ()
{
return materialName;
}
public String localizedName() { return StatCollector.translateToLocal("material." + materialName.toLowerCase()); }
public String prefixName()
{
// check if there's a special name, otherwise use the regular one
if(StatCollector.canTranslate(String.format("material.%s.display", materialName.toLowerCase())))
return StatCollector.translateToLocal(String.format("material.%s.display", materialName.toLowerCase()));
return localizedName();
}
public int durability ()
{
return this.durability;
}
public int toolSpeed ()
{
return this.miningspeed;
}
public int attack ()
{
return this.attack;
}
public int harvestLevel ()
{
return this.harvestLevel;
}
public float handleDurability ()
{
return this.handleModifier;
}
public int reinforced ()
{
return this.reinforced;
}
public float shoddy ()
{
return this.stonebound;
}
public String style ()
{
return this.tipStyle;
}
public String ability ()
{
return this.ability;
}
public String localizedAbility () { return StatCollector.translateToLocal(this.ability); }
}