aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/gui/CustomMusicGui.java
blob: 98210f5816fd6ae6bd25408e9a40e984c73d2adc (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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package me.Danker.gui;

import me.Danker.commands.ToggleCommand;
import me.Danker.features.CustomMusic;
import me.Danker.handlers.ConfigHandler;
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 CustomMusicGui extends GuiScreen {

    private int page;

    private GuiButton goBack;
    private GuiButton backPage;
    private GuiButton nextPage;

    private GuiButton dungeonBossMusic;
    private GuiButton bloodRoomMusic;
    private GuiButton dungeonMusic;
    private GuiButton hubMusic;
    private GuiButton islandMusic;
    private GuiButton dungeonHubMusic;
    private GuiButton farmingIslandsMusic;
    private GuiButton goldMineMusic;
    private GuiButton deepCavernsMusic;
    private GuiButton dwarvenMinesMusic;
    private GuiButton crystalHollowsMusic;
    private GuiButton spidersDenMusic;
    private GuiButton crimsonIsleMusic;
    private GuiButton endMusic;
    private GuiButton parkMusic;

    public CustomMusicGui(int page) {
        this.page = page;
    }

    @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");
        backPage = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 80, 20, "< Back");
        nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >");

        dungeonMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Custom Dungeon Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonMusic));
        bloodRoomMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Custom Blood Room Music: " + Utils.getColouredBoolean(ToggleCommand.bloodRoomMusic));
        dungeonBossMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic));
        hubMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Custom Hub Music: " + Utils.getColouredBoolean(ToggleCommand.hubMusic));
        islandMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Custom Island Music: " + Utils.getColouredBoolean(ToggleCommand.islandMusic));
        dungeonHubMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Custom Dungeon Hub Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonHubMusic));
        farmingIslandsMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Custom Farming Islands Music: " + Utils.getColouredBoolean(ToggleCommand.farmingIslandsMusic));
        goldMineMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Custom Gold Mine Music: " + Utils.getColouredBoolean(ToggleCommand.goldMineMusic));
        deepCavernsMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Custom Deep Caverns Music: " + Utils.getColouredBoolean(ToggleCommand.deepCavernsMusic));
        dwarvenMinesMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Custom Dwarven Mines Music: " + Utils.getColouredBoolean(ToggleCommand.dwarvenMinesMusic));
        crystalHollowsMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Custom Crystal Hollows Music: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowsMusic));
        spidersDenMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Custom Spider's Den Music: " + Utils.getColouredBoolean(ToggleCommand.spidersDenMusic));
        crimsonIsleMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Custom Crimson Isle Music: " + Utils.getColouredBoolean(ToggleCommand.crimsonIsleMusic));
        endMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Custom End Music: " + Utils.getColouredBoolean(ToggleCommand.endMusic));
        parkMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Custom Park Music: " + Utils.getColouredBoolean(ToggleCommand.parkMusic));

        switch (page) {
            case 1:
                this.buttonList.add(dungeonMusic);
                this.buttonList.add(bloodRoomMusic);
                this.buttonList.add(dungeonBossMusic);
                this.buttonList.add(hubMusic);
                this.buttonList.add(islandMusic);
                this.buttonList.add(dungeonHubMusic);
                this.buttonList.add(farmingIslandsMusic);
                this.buttonList.add(nextPage);
                break;
            case 2:
                this.buttonList.add(goldMineMusic);
                this.buttonList.add(deepCavernsMusic);
                this.buttonList.add(dwarvenMinesMusic);
                this.buttonList.add(crystalHollowsMusic);
                this.buttonList.add(spidersDenMusic);
                this.buttonList.add(crimsonIsleMusic);
                this.buttonList.add(endMusic);
                this.buttonList.add(nextPage);
                this.buttonList.add(backPage);
                break;
            case 3:
                this.buttonList.add(parkMusic);
                this.buttonList.add(backPage);
                break;
        }

        this.buttonList.add(goBack);
    }

    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        this.drawDefaultBackground();
        super.drawScreen(mouseX, mouseY, partialTicks);
    }

    @Override
    public void actionPerformed(GuiButton button) {
        if (button == goBack) {
            mc.displayGuiScreen(new DankerGui(1, ""));
        } else if (button == backPage) {
            Minecraft.getMinecraft().displayGuiScreen(new CustomMusicGui(page - 1));
        } else if (button == nextPage) {
            Minecraft.getMinecraft().displayGuiScreen(new CustomMusicGui(page + 1));
        } else if (button == dungeonBossMusic) {
            ToggleCommand.dungeonBossMusic = !ToggleCommand.dungeonBossMusic;
            CustomMusic.dungeonboss.stop();
            ConfigHandler.writeBooleanConfig("toggles", "DungeonBossMusic", ToggleCommand.dungeonBossMusic);
            dungeonBossMusic.displayString = "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic);
        } else if (button == bloodRoomMusic) {
            ToggleCommand.bloodRoomMusic = !ToggleCommand.bloodRoomMusic;
            CustomMusic.bloodroom.stop();
            ConfigHandler.writeBooleanConfig("toggles", "BloodRoomMusic", ToggleCommand.bloodRoomMusic);
            bloodRoomMusic.displayString = "Custom Blood Room Music: " + Utils.getColouredBoolean(ToggleCommand.bloodRoomMusic);
        } else if (button == dungeonMusic) {
            ToggleCommand.dungeonMusic = !ToggleCommand.dungeonMusic;
            CustomMusic.dungeon.stop();
            ConfigHandler.writeBooleanConfig("toggles", "DungeonMusic", ToggleCommand.dungeonMusic);
            dungeonMusic.displayString = "Custom Dungeon Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonMusic);
        } else if (button == hubMusic) {
            ToggleCommand.hubMusic = !ToggleCommand.hubMusic;
            CustomMusic.hub.stop();
            ConfigHandler.writeBooleanConfig("toggles", "HubMusic", ToggleCommand.hubMusic);
            hubMusic.displayString = "Custom Hub Music: " + Utils.getColouredBoolean(ToggleCommand.hubMusic);
        } else if (button == islandMusic) {
            ToggleCommand.islandMusic = !ToggleCommand.islandMusic;
            CustomMusic.island.stop();
            ConfigHandler.writeBooleanConfig("toggles", "IslandMusic", ToggleCommand.islandMusic);
            islandMusic.displayString = "Custom Island Music: " + Utils.getColouredBoolean(ToggleCommand.islandMusic);
        } else if (button == dungeonHubMusic) {
            ToggleCommand.dungeonHubMusic = !ToggleCommand.dungeonHubMusic;
            CustomMusic.dungeonHub.stop();
            ConfigHandler.writeBooleanConfig("toggles", "DungeonHubMusic", ToggleCommand.dungeonHubMusic);
            dungeonHubMusic.displayString = "Custom Dungeon Hub Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonHubMusic);
        } else if (button == farmingIslandsMusic) {
            ToggleCommand.farmingIslandsMusic = !ToggleCommand.farmingIslandsMusic;
            CustomMusic.farmingIslands.stop();
            ConfigHandler.writeBooleanConfig("toggles", "FarmingIslandsMusic", ToggleCommand.farmingIslandsMusic);
            farmingIslandsMusic.displayString = "Custom Farming Islands Music: " + Utils.getColouredBoolean(ToggleCommand.farmingIslandsMusic);
        } else if (button == goldMineMusic) {
            ToggleCommand.goldMineMusic = !ToggleCommand.goldMineMusic;
            CustomMusic.goldMine.stop();
            ConfigHandler.writeBooleanConfig("toggles", "GoldMineMusic", ToggleCommand.goldMineMusic);
            goldMineMusic.displayString = "Custom Gold Mine Music: " + Utils.getColouredBoolean(ToggleCommand.goldMineMusic);
        } else if (button == deepCavernsMusic) {
            ToggleCommand.deepCavernsMusic = !ToggleCommand.deepCavernsMusic;
            CustomMusic.deepCaverns.stop();
            ConfigHandler.writeBooleanConfig("toggles", "DeepCavernsMusic", ToggleCommand.deepCavernsMusic);
            deepCavernsMusic.displayString = "Custom Deep Caverns Music: " + Utils.getColouredBoolean(ToggleCommand.deepCavernsMusic);
        } else if (button == dwarvenMinesMusic) {
            ToggleCommand.dwarvenMinesMusic = !ToggleCommand.dwarvenMinesMusic;
            CustomMusic.dwarvenMines.stop();
            ConfigHandler.writeBooleanConfig("toggles", "DwarvenMinesMusic", ToggleCommand.dwarvenMinesMusic);
            dwarvenMinesMusic.displayString = "Custom Dwarven Mines Music: " + Utils.getColouredBoolean(ToggleCommand.dwarvenMinesMusic);
        } else if (button == crystalHollowsMusic) {
            ToggleCommand.crystalHollowsMusic = !ToggleCommand.crystalHollowsMusic;
            CustomMusic.crystalHollows.stop();
            ConfigHandler.writeBooleanConfig("toggles", "CrystalHollowsMusic", ToggleCommand.crystalHollowsMusic);
            crystalHollowsMusic.displayString = "Custom Crystal Hollows Music: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowsMusic);
        } else if (button == spidersDenMusic) {
            ToggleCommand.spidersDenMusic = !ToggleCommand.spidersDenMusic;
            CustomMusic.spidersDen.stop();
            ConfigHandler.writeBooleanConfig("toggles", "SpidersDenMusic", ToggleCommand.spidersDenMusic);
            spidersDenMusic.displayString = "Custom Spider's Den Music: " + Utils.getColouredBoolean(ToggleCommand.spidersDenMusic);
        } else if (button == crimsonIsleMusic) {
            ToggleCommand.crimsonIsleMusic = !ToggleCommand.crimsonIsleMusic;
            CustomMusic.crimsonIsle.stop();
            ConfigHandler.writeBooleanConfig("toggles", "BlazingFortressMusic", ToggleCommand.crimsonIsleMusic);
            crimsonIsleMusic.displayString = "Custom Crimson Isle Music: " + Utils.getColouredBoolean(ToggleCommand.crimsonIsleMusic);
        } else if (button == endMusic) {
            ToggleCommand.endMusic = !ToggleCommand.endMusic;
            CustomMusic.end.stop();
            ConfigHandler.writeBooleanConfig("toggles", "EndMusic", ToggleCommand.endMusic);
            endMusic.displayString = "Custom End Music: " + Utils.getColouredBoolean(ToggleCommand.endMusic);
        } else if (button == parkMusic) {
            ToggleCommand.parkMusic = !ToggleCommand.parkMusic;
            CustomMusic.park.stop();
            ConfigHandler.writeBooleanConfig("toggles", "ParkMusic", ToggleCommand.parkMusic);
            parkMusic.displayString = "Custom Park Music: " + Utils.getColouredBoolean(ToggleCommand.parkMusic);
        }
    }

}