/
WandRod.java
158 lines (126 loc) · 3.49 KB
/
WandRod.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package thaumcraft.api.wands;
import java.util.LinkedHashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
/**
*
* @author Azanor
*
* This class is used to keep the material information for the various rods.
* It is also used to generate the wand recipes ingame.
*
*/
public class WandRod {
private String tag;
/**
* Cost to craft this wand. Combined with the rod cost.
*/
private int craftCost;
/**
* The amount of vis that can be stored - this number is actually multiplied
* by 100 for use by the wands internals
*/
int capacity;
/**
* The texture that will be used for the ingame wand rod
*/
protected ResourceLocation texture;
/**
* the actual item that makes up this rod and will be used to generate the wand recipes
*/
ItemStack item;
/**
* A class that will be called whenever the wand onUpdate tick is run
*/
IWandRodOnUpdate onUpdate;
/**
* Does the rod glow in the dark?
*/
boolean glow;
public static LinkedHashMap<String,WandRod> rods = new LinkedHashMap<String,WandRod>();
public WandRod (String tag, int capacity, ItemStack item, int craftCost, ResourceLocation texture) {
this.setTag(tag);
this.capacity = capacity;
this.texture = texture;
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
}
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate, ResourceLocation texture) {
this.setTag(tag);
this.capacity = capacity;
this.texture = texture;
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
this.onUpdate = onUpdate;
}
public WandRod (String tag, int capacity, ItemStack item, int craftCost) {
this.setTag(tag);
this.capacity = capacity;
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
}
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate) {
this.setTag(tag);
this.capacity = capacity;
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
this.onUpdate = onUpdate;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public ResourceLocation getTexture() {
return texture;
}
public void setTexture(ResourceLocation texture) {
this.texture = texture;
}
public ItemStack getItem() {
return item;
}
public void setItem(ItemStack item) {
this.item = item;
}
public int getCraftCost() {
return craftCost;
}
public void setCraftCost(int craftCost) {
this.craftCost = craftCost;
}
public IWandRodOnUpdate getOnUpdate() {
return onUpdate;
}
public void setOnUpdate(IWandRodOnUpdate onUpdate) {
this.onUpdate = onUpdate;
}
public boolean isGlowing() {
return glow;
}
public void setGlowing(boolean hasGlow) {
this.glow = hasGlow;
}
/**
* The research a player needs to have finished to be able to craft a wand with this rod.
*/
public String getResearch() {
return "ROD_"+getTag();
}
// Some examples:
// WandRod WAND_ROD_WOOD = new WandRod("wood",25,new ItemStack(Item.stick),1);
// WandRod WAND_ROD_BLAZE = new WandRod("blaze",100,new ItemStack(Item.blazeRod),7,new WandRodBlazeOnUpdate());
}