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
|
package me.Danker.gui;
import me.Danker.DankersSkyblockMod;
import me.Danker.features.SkillTracker;
import me.Danker.handlers.ConfigHandler;
import me.Danker.handlers.TextRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import org.apache.commons.lang3.time.StopWatch;
public class SkillTrackerGui extends GuiScreen {
private GuiButton goBack;
private GuiButton start;
private GuiButton stop;
private GuiButton reset;
private GuiButton hide;
private GuiButton show;
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
public void initGui() {
super.initGui();
ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
int height = sr.getScaledHeight();
int width = sr.getScaledWidth();
goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back");
start = new GuiButton(0, width / 2 - 140, (int) (height * 0.45), 80, 20, "Start");
stop = new GuiButton(0, width / 2 - 40, (int) (height * 0.45), 80, 20, "Stop");
reset = new GuiButton(0, width / 2 + 60, (int) (height * 0.45), 80, 20, "Reset");
hide = new GuiButton(0, width / 2 - 70, (int) (height * 0.55), 60, 20, "Hide");
show = new GuiButton(0, width / 2 + 10, (int) (height * 0.55), 60, 20, "Show");
this.buttonList.add(start);
this.buttonList.add(stop);
this.buttonList.add(reset);
this.buttonList.add(hide);
this.buttonList.add(show);
this.buttonList.add(goBack);
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
String stateText = "";
if (SkillTracker.skillStopwatch.isStarted() && !SkillTracker.skillStopwatch.isSuspended()) {
stateText = "Timer: Running";
} else if (!SkillTracker.skillStopwatch.isStarted() || SkillTracker.skillStopwatch.isSuspended()) {
stateText = "Timer: Paused";
}
if (!SkillTracker.showSkillTracker) {
stateText += " (Hidden)";
}
int stateTextWidth = mc.fontRendererObj.getStringWidth(stateText);
new TextRenderer(mc, stateText, width / 2 - stateTextWidth / 2, 10, 1D);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public void actionPerformed(GuiButton button) {
if (button == goBack) {
mc.displayGuiScreen(new DankerGui(1, ""));
} else if (button == start) {
if (SkillTracker.skillStopwatch.isStarted() && SkillTracker.skillStopwatch.isSuspended()) {
SkillTracker.skillStopwatch.resume();
} else if (!SkillTracker.skillStopwatch.isStarted()) {
SkillTracker.skillStopwatch.start();
}
} else if (button == stop) {
if (SkillTracker.skillStopwatch.isStarted() && !SkillTracker.skillStopwatch.isSuspended()) {
SkillTracker.skillStopwatch.suspend();
}
} else if (button == reset) {
SkillTracker.skillStopwatch = new StopWatch();
SkillTracker.farmingXPGained = 0;
SkillTracker.miningXPGained = 0;
SkillTracker.combatXPGained = 0;
SkillTracker.foragingXPGained = 0;
SkillTracker.fishingXPGained = 0;
SkillTracker.enchantingXPGained = 0;
SkillTracker.alchemyXPGained = 0;
} else if (button == hide) {
SkillTracker.showSkillTracker = false;
ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false);
} else if (button == show) {
SkillTracker.showSkillTracker = true;
ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true);
}
}
}
|