blob: 63462b8d9bbe918e599074fffa064f1675dd347d (
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
|
package gregtech.common.items.behaviors;
import java.util.List;
import net.minecraft.item.ItemStack;
import gregtech.api.items.MetaBaseItem;
import gregtech.api.util.GTUtility;
public class BehaviourDataStick extends BehaviourNone {
@Override
public List<String> getAdditionalToolTips(MetaBaseItem aItem, List<String> aList, ItemStack aStack) {
String tString = GTUtility.ItemNBT.getBookTitle(aStack);
if (GTUtility.isStringValid(tString)) {
aList.add(tString);
}
tString = GTUtility.ItemNBT.getBookAuthor(aStack);
if (GTUtility.isStringValid(tString)) {
aList.add("by " + tString);
}
short tMapID = GTUtility.ItemNBT.getMapID(aStack);
if (tMapID >= 0) {
aList.add("Map ID: " + tMapID);
}
tString = GTUtility.ItemNBT.getPunchCardData(aStack);
if (GTUtility.isStringValid(tString)) {
aList.add("Punch Card Data");
int i = 0;
int j = tString.length();
for (; i < j; i += 64) {
aList.add(tString.substring(i, Math.min(i + 64, j)));
}
}
short sTier = GTUtility.ItemNBT.getNBT(aStack)
.getShort("rocket_tier");
if (sTier > 0 && sTier < 100) {
aList.add("Rocket Schematic Tier: " + sTier);
} else if (sTier >= 100) {
switch (sTier) {
case 100 -> aList.add("Moonbuggy Schematic");
case 101 -> aList.add("Cargo-Rocket Schematic");
case 102 -> aList.add("Astro-Miner Schematic");
}
}
long lastUpdate = GTUtility.ItemNBT.getNBT(aStack)
.getLong("lastUpdate");
if (lastUpdate != 0) aList.add(String.format("Last update at: %tc", lastUpdate));
return aList;
}
}
|