forked from daveyliam/mapwriter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMwGuiOptions.java
106 lines (92 loc) · 3.11 KB
/
MwGuiOptions.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
package mapwriter;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
public class MwGuiOptions extends GuiScreen {
private final Mw mw;
private final GuiScreen parentScreen;
public MwGuiOptions(Mw mw, GuiScreen parentScreen) {
this.mw = mw;
this.parentScreen = parentScreen;
}
public void initGui() {
this.buttonList.clear();
this.buttonList.add(new GuiButton(1, 0, 0, this.getDrawCoordsString()));
this.buttonList.add(new GuiButton(2, 0, 0, this.getCircularModeString()));
this.buttonList.add(new GuiButton(5, 0, 0, this.getTrailString()));
this.buttonList.add(new GuiButton(3, 0, 0, this.getTextureSizeString()));
this.buttonList.add(new GuiButton(4, 0, 0, this.getTextureScalingString()));
this.buttonList.add(new GuiButton(0, 0, 0, "Done"));
int y = Math.max(60, this.height / 4);
int x = this.width / 2 - 100;
for (Object o : this.buttonList) {
GuiButton button = (GuiButton) o;
button.xPosition = x;
button.yPosition = y;
y += 25;
}
}
String getDrawCoordsString() {
return "Draw coords: " + this.mw.coordsEnabled;
}
String getCircularModeString() {
return "Circular mode: " + this.mw.overlayManager.smallMapMode.circular;
}
String getTextureSizeString() {
return "Texture size: " + this.mw.configTextureSize;
}
String getTextureScalingString() {
return "Texture scaling: " + (this.mw.linearTextureScalingEnabled ? "linear" : "nearest");
}
String getTrailString() {
return "Trail Markers: " + (this.mw.playerTrail.enabled);
}
protected void actionPerformed(GuiButton button) {
switch (button.id) {
case 0:
// done
// reconfigure texture size
this.mw.setTextureSize();
this.mc.displayGuiScreen(this.parentScreen);
break;
case 1:
// toggle coords
this.mw.toggleCoords();
button.displayString = this.getDrawCoordsString();
break;
case 2:
// toggle circular
this.mw.overlayManager.toggleRotating();
button.displayString = this.getCircularModeString();
break;
case 3:
// toggle texture size
this.mw.configTextureSize *= 2;
if (this.mw.configTextureSize > 4096) {
this.mw.configTextureSize = 1024;
}
button.displayString = this.getTextureSizeString();
break;
case 4:
// linear scaling
this.mw.linearTextureScalingEnabled = !this.mw.linearTextureScalingEnabled;
this.mw.mapTexture.setLinearScaling(this.mw.linearTextureScalingEnabled);
button.displayString = this.getTextureScalingString();
break;
case 5:
// player trail
this.mw.playerTrail.enabled = !this.mw.playerTrail.enabled;
button.displayString = this.getTrailString();
break;
default:
break;
}
}
public void updateScreen() {
super.updateScreen();
}
public void drawScreen(int mouseX, int mouseY, float f) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, "MapWriter Options", this.width / 2, 40, 0xffffff);
super.drawScreen(mouseX, mouseY, f);
}
}