aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/gui/CustomMusicGui.java
blob: 505bf344b095098c7a4b3e20cd96c1d7e2417311 (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
package me.Danker.gui;

import me.Danker.DankersSkyblockMod;
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 GuiButton goBack;

    private GuiButton dungeonBossMusic;
    private GuiButton bloodRoomMusic;
    private GuiButton dungeonMusic;

    @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");
        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));

        this.buttonList.add(dungeonMusic);
        this.buttonList.add(bloodRoomMusic);
        this.buttonList.add(dungeonBossMusic);
        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) {
            DankersSkyblockMod.guiToOpen = "dankergui1";
        } 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);
        }
    }

}