aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/gui/OnlySlayerGui.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-10-09 10:54:39 -0400
committerbowser0000 <bowser0000@gmail.com>2020-10-09 10:54:39 -0400
commit68111a9d9c9d403436dc2041010f337580d48d60 (patch)
treefa66b56133e317b08f60c4e84d556c3ec70e1f98 /src/main/java/me/Danker/gui/OnlySlayerGui.java
parent5d477d9d06933c7a52ea5df17160b89391387872 (diff)
downloadSkyblockMod-68111a9d9c9d403436dc2041010f337580d48d60.tar.gz
SkyblockMod-68111a9d9c9d403436dc2041010f337580d48d60.tar.bz2
SkyblockMod-68111a9d9c9d403436dc2041010f337580d48d60.zip
Add GUI: /dsm
No GUI for moving or scaling displays yet
Diffstat (limited to 'src/main/java/me/Danker/gui/OnlySlayerGui.java')
-rw-r--r--src/main/java/me/Danker/gui/OnlySlayerGui.java129
1 files changed, 129 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java
new file mode 100644
index 0000000..0573777
--- /dev/null
+++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java
@@ -0,0 +1,129 @@
+package me.Danker.gui;
+
+import me.Danker.commands.BlockSlayerCommand;
+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;
+
+public class OnlySlayerGui extends GuiScreen {
+
+ private int onlyNumberInt = 4;
+ private String onlyName = "Revenant Horror";
+
+ private GuiButton off;
+ private GuiButton zombie;
+ private GuiButton spider;
+ private GuiButton wolf;
+ private GuiButton one;
+ private GuiButton two;
+ private GuiButton three;
+ private GuiButton four;
+
+ @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();
+
+ onlyName = BlockSlayerCommand.onlySlayerName;
+ if (BlockSlayerCommand.onlySlayerNumber.equals("I")) {
+ onlyNumberInt = 1;
+ } else if (BlockSlayerCommand.onlySlayerNumber.equals("II")) {
+ onlyNumberInt = 2;
+ } else if (BlockSlayerCommand.onlySlayerNumber.equals("III")) {
+ onlyNumberInt = 3;
+ } else {
+ onlyNumberInt = 4;
+ }
+
+ off = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Off");
+ zombie = new GuiButton(0, width / 2 - 200, (int) (height * 0.4), 120, 20, "Zombie");
+ spider = new GuiButton(0, width / 2 - 60, (int) (height * 0.4), 120, 20, "Spider");
+ wolf = new GuiButton(0, width / 2 + 80, (int) (height * 0.4), 120, 20, "Wolf");
+ one = new GuiButton(0, width / 2 - 190, (int) (height * 0.6), 85, 20, "I");
+ two = new GuiButton(0, width / 2 - 95, (int) (height * 0.6), 85, 20, "II");
+ three = new GuiButton(0, width / 2 + 10, (int) (height * 0.6), 85, 20, "III");
+ four = new GuiButton(0, width / 2 + 115, (int) (height * 0.6), 85, 20, "IV");
+
+ this.buttonList.add(off);
+ this.buttonList.add(zombie);
+ this.buttonList.add(spider);
+ this.buttonList.add(wolf);
+ this.buttonList.add(one);
+ this.buttonList.add(two);
+ this.buttonList.add(three);
+ this.buttonList.add(four);
+ }
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ this.drawDefaultBackground();
+ Minecraft mc = Minecraft.getMinecraft();
+
+ String displayText;
+ if (BlockSlayerCommand.onlySlayerName.equals("")) {
+ displayText = "Only Allow Slayer: Off";
+ } else {
+ displayText = "Only Allow Slayer: " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber;
+ }
+ int displayWidth = mc.fontRendererObj.getStringWidth(displayText);
+ new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D);
+
+ super.drawScreen(mouseX, mouseY, partialTicks);
+ }
+
+ @Override
+ public void actionPerformed(GuiButton button) {
+ if (button == off) {
+ BlockSlayerCommand.onlySlayerName = "";
+ BlockSlayerCommand.onlySlayerNumber = "";
+ ConfigHandler.writeStringConfig("toggles", "BlockSlayer", "");
+ return;
+ } else if (button == zombie) {
+ onlyName = "Revenant Horror";
+ } else if (button == spider) {
+ onlyName = "Tarantula Broodfather";
+ } else if (button == wolf) {
+ onlyName = "Sven Packmaster";
+ } else if (button == one) {
+ onlyNumberInt = 1;
+ } else if (button == two) {
+ onlyNumberInt = 2;
+ } else if (button == three) {
+ onlyNumberInt = 3;
+ } else if (button == four) {
+ onlyNumberInt = 4;
+ }
+
+ String onlyNumber;
+ switch (onlyNumberInt) {
+ case 1:
+ onlyNumber = "I";
+ break;
+ case 2:
+ onlyNumber = "II";
+ break;
+ case 3:
+ onlyNumber = "III";
+ break;
+ case 4:
+ default:
+ onlyNumber = "IV";
+ }
+
+ BlockSlayerCommand.onlySlayerName = onlyName;
+ BlockSlayerCommand.onlySlayerNumber = onlyNumber;
+ ConfigHandler.writeStringConfig("toggles", "BlockSlayer", BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber);
+ }
+
+}