blob: 71fce08c7e9a177bd860dee017d7cdbf0a99544f (
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
|
package gregtech.api.metatileentity.implementations;
import java.util.concurrent.atomic.AtomicReferenceArray;
import org.lwjgl.input.Keyboard;
import gregtech.api.GregTechAPI;
import gregtech.api.interfaces.ISecondaryDescribable;
import gregtech.api.util.MultiblockTooltipBuilder;
/**
* A multiblock with tooltip {@link MultiblockTooltipBuilder}
*/
public abstract class MTETooltipMultiBlockBase extends MTEMultiBlockBase implements ISecondaryDescribable {
private static final AtomicReferenceArray<MultiblockTooltipBuilder> tooltips = new AtomicReferenceArray<>(
GregTechAPI.METATILEENTITIES.length);
public MTETooltipMultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
public MTETooltipMultiBlockBase(String aName) {
super(aName);
}
protected MultiblockTooltipBuilder getTooltip() {
int tId = getBaseMetaTileEntity().getMetaTileID();
MultiblockTooltipBuilder tooltip = tooltips.get(tId);
if (tooltip == null) {
tooltip = createTooltip();
tooltips.set(tId, tooltip);
}
return tooltip;
}
protected abstract MultiblockTooltipBuilder createTooltip();
@Override
public String[] getDescription() {
return getCurrentDescription();
}
@Override
public boolean isDisplaySecondaryDescription() {
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
}
public String[] getPrimaryDescription() {
return getTooltip().getInformation();
}
public String[] getSecondaryDescription() {
return getTooltip().getStructureInformation();
}
}
|