diff options
author | olim <bobq4582@gmail.com> | 2024-01-30 12:28:25 +0000 |
---|---|---|
committer | olim <bobq4582@gmail.com> | 2024-01-30 12:28:25 +0000 |
commit | fb583f4d085e4b34609e24399a72701210bb682c (patch) | |
tree | efbd102fe3b27380db54f39ee1754bb34dcbbae5 /src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java | |
parent | 81e17a23645f429f91f77663928372bdf0833e16 (diff) | |
download | Skyblocker-fb583f4d085e4b34609e24399a72701210bb682c.tar.gz Skyblocker-fb583f4d085e4b34609e24399a72701210bb682c.tar.bz2 Skyblocker-fb583f4d085e4b34609e24399a72701210bb682c.zip |
start of crystal hollows fetures
basic implementation of a map and way-points features for the crystal hollows
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java new file mode 100644 index 00000000..18be8bed --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java @@ -0,0 +1,64 @@ +package de.hysky.skyblocker.skyblock.dwarven; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.skyblock.tabhud.widget.hud.HudCommsWidget; +import de.hysky.skyblocker.utils.render.RenderHelper; +import it.unimi.dsi.fastutil.ints.IntIntPair; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.text.Text; + +import java.awt.*; + +public class CrystalsHudConfigScreen extends Screen { + + private int hudX = SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.x; + private int hudY = SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.y; + private final Screen parent; + + protected CrystalsHudConfigScreen() { + this(null); + } + + public CrystalsHudConfigScreen(Screen parent) { + super(Text.of("Crystals HUD Config")); + this.parent = parent; + } + + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + super.render(context, mouseX, mouseY, delta); + renderBackground(context, mouseX, mouseY, delta); + CrystalsHud.render( context, hudX, hudY); + context.drawCenteredTextWithShadow(textRenderer, "Right Click To Reset Position", width / 2, height / 2, Color.GRAY.getRGB()); + } + + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) { + IntIntPair dims = CrystalsHud.getDimForConfig(); + if (RenderHelper.pointIsInArea(mouseX, mouseY, hudX, hudY, hudX + 200, hudY + 40) && button == 0) { + hudX = (int) Math.max(Math.min(mouseX - (double) dims.leftInt() / 2, this.width - dims.leftInt()), 0); + hudY = (int) Math.max(Math.min(mouseY - (double) dims.rightInt() / 2, this.height - dims.rightInt()), 0); + } + return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY); + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (button == 1) { + IntIntPair dims = CrystalsHud.getDimForConfig(); + hudX = this.width / 2 - dims.leftInt(); + hudY = this.height / 2 - dims.rightInt(); + } + return super.mouseClicked(mouseX, mouseY, button); + } + + @Override + public void close() { + SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.x = hudX; + SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.y = hudY; + SkyblockerConfigManager.save(); + + client.setScreen(parent); + } +} |