aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/gui/DisplayGui.java
blob: e5a6641e8cfdebcf2960e76a3058745cdf880903 (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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package me.Danker.gui;

import me.Danker.DankersSkyblockMod;
import me.Danker.features.loot.LootDisplay;
import me.Danker.handlers.ConfigHandler;
import me.Danker.handlers.TextRenderer;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;

public class DisplayGui extends GuiScreen {

	private boolean addSession = false;
	
	private GuiButton goBack;
	private GuiButton off;
	private GuiButton showSession;
	private GuiButton zombie;
	private GuiButton spider;
	private GuiButton wolf;
	private GuiButton enderman;
	private GuiButton auto;
	private GuiButton fishing;
	private GuiButton fishingWinter;
	private GuiButton fishingFestival;
	private GuiButton fishingSpooky;
	private GuiButton mythological;
	private GuiButton catacombsF1;
	private GuiButton catacombsF2;
	private GuiButton catacombsF3;
	private GuiButton catacombsF4;
	private GuiButton catacombsF5;
	private GuiButton catacombsF6;
	private GuiButton catacombsF7;
	private GuiButton ghost;
	
	@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");
		showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession));
		off = new GuiButton(0, width / 2 - 210, (int) (height * 0.2), "Off");
		auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto");
		zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.3), 100, 20, "Zombie");
		spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.3), 100, 20, "Spider");
		wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.3), 100, 20, "Wolf");
		enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.3), 100, 20, "Enderman");
		fishing = new GuiButton(0, width / 2 - 230, (int) (height * 0.4), 100, 20, "Fishing");
		fishingWinter = new GuiButton(0, width / 2 - 110, (int) (height * 0.4), 100, 20, "Fishing Winter");
		fishingFestival = new GuiButton(0, width / 2 + 10, (int) (height * 0.4), 100, 20, "Fishing Festival");
		fishingSpooky = new GuiButton(0, width / 2 + 130, (int) (height * 0.4), 100, 20, "Fishing Spooky");
		mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), 95, 20, "Mythological");
		ghost = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 95, 20, "Ghost");
		catacombsF1 = new GuiButton(0, width / 2 - 205, (int) (height * 0.65), 50, 20, "F1");
		catacombsF2 = new GuiButton(0, width / 2 - 145, (int) (height * 0.65), 50, 20, "F2");
		catacombsF3 = new GuiButton(0, width / 2 - 85, (int) (height * 0.65), 50, 20, "F3");
		catacombsF4 = new GuiButton(0, width / 2 - 25, (int) (height * 0.65), 50, 20, "F4");
		catacombsF5 = new GuiButton(0, width / 2 + 35, (int) (height * 0.65), 50, 20, "F5");
		catacombsF6 = new GuiButton(0, width / 2 + 95, (int) (height * 0.65), 50, 20, "F6");
		catacombsF7 = new GuiButton(0, width / 2 + 155, (int) (height * 0.65), 50, 20, "F7");

		this.buttonList.add(showSession);
		this.buttonList.add(off);
		this.buttonList.add(auto);
		this.buttonList.add(zombie);
		this.buttonList.add(spider);
		this.buttonList.add(wolf);
		this.buttonList.add(enderman);
		this.buttonList.add(fishing);
		this.buttonList.add(fishingWinter);
		this.buttonList.add(fishingFestival);
		this.buttonList.add(fishingSpooky);
		this.buttonList.add(mythological);
		this.buttonList.add(catacombsF1);
		this.buttonList.add(catacombsF2);
		this.buttonList.add(catacombsF3);
		this.buttonList.add(catacombsF4);
		this.buttonList.add(catacombsF5);
		this.buttonList.add(catacombsF6);
		this.buttonList.add(catacombsF7);
		this.buttonList.add(ghost);
		this.buttonList.add(goBack);
	}
	
	@Override
	public void drawScreen(int mouseX, int mouseY, float partialTicks) {
		this.drawDefaultBackground();
		Minecraft mc = Minecraft.getMinecraft();
		
		String displayText;
		if (LootDisplay.auto) {
			displayText = "Current Display: auto";
		} else {
			displayText = "Current Display: " + LootDisplay.display;
		}
		int displayWidth = mc.fontRendererObj.getStringWidth(displayText);
		new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D);
		
		String catacombsTitleText = "Catacombs Dungeon";
		int catacombsTitleWidth = mc.fontRendererObj.getStringWidth(catacombsTitleText);
		new TextRenderer(mc, catacombsTitleText, width / 2 - catacombsTitleWidth / 2, (int) (height * 0.6), 1D);
		
		super.drawScreen(mouseX, mouseY, partialTicks);
	}
	
	@Override
	public void actionPerformed(GuiButton button) {
		if (button == goBack) {
			DankersSkyblockMod.guiToOpen = "dankergui1";
		} else if (button == showSession) {
			addSession = !addSession;
			showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession);
		} else if (button == off) {
			setDisplay("off", true);
		} else if (button == zombie) {
			setDisplay("zombie", false);
		} else if (button == spider) {
			setDisplay("spider", false);
		} else if (button == wolf) {
			setDisplay("wolf", false);
		} else if (button == enderman) {
			setDisplay("enderman", false);
		} else if (button == auto) {
			LootDisplay.auto = true;
			ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true);
		} else if (button == fishing) {
			setDisplay("fishing", false);
		} else if (button == fishingWinter) {
			setDisplay("fishing_winter", false);
		} else if (button == fishingFestival) {
			setDisplay("fishing_festival", false);
		} else if (button == fishingSpooky) {
			setDisplay("fishing_spooky", false);
		} else if (button == mythological) {
			setDisplay("mythological", false);
		} else if (button == catacombsF1) {
			setDisplay("catacombs_floor_one", false);
		} else if (button == catacombsF2) {
			setDisplay("catacombs_floor_two", false);
		} else if (button == catacombsF3) {
			setDisplay("catacombs_floor_three", false);
		} else if (button == catacombsF4) {
			setDisplay("catacombs_floor_four", false);
		} else if (button == catacombsF5) {
			setDisplay("catacombs_floor_five", false);
		} else if (button == catacombsF6) {
			setDisplay("catacombs_floor_six", false);
		} else if (button == catacombsF7) {
			setDisplay("catacombs_floor_seven", false);
		} else if (button == ghost)
			setDisplay("ghost",false);
	}
	
	public void setDisplay(String display, boolean forceNoSession) {
		if (!forceNoSession && addSession) display += "_session";
		LootDisplay.auto = false;
		LootDisplay.display = display;
		ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false);
		ConfigHandler.writeStringConfig("misc", "display", display);
	}
	
}