From 4a43b965bb0b105eb5c614932f965449e930f56b Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sat, 9 Mar 2024 16:56:14 -0500 Subject: Refactor Hud Config Screens and fix dragging --- .../hysky/skyblocker/skyblock/dwarven/CrystalsHud.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java index 7b15c61e..f113561f 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java @@ -4,7 +4,6 @@ import de.hysky.skyblocker.SkyblockerMod; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.scheduler.Scheduler; -import it.unimi.dsi.fastutil.ints.IntIntPair; import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; @@ -14,14 +13,13 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RotationAxis; +import org.joml.Vector2i; +import org.joml.Vector2ic; import java.awt.*; import java.util.Arrays; import java.util.Map; -import org.joml.Vector2i; -import org.joml.Vector2ic; - public class CrystalsHud { private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); protected static final Identifier MAP_TEXTURE = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/crystals_map.png"); @@ -47,9 +45,8 @@ public class CrystalsHud { }); } - protected static IntIntPair getDimensionsForConfig() { - int size = (int) (62 * SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.mapScaling); - return IntIntPair.of(size, size); + protected static int getDimensionsForConfig() { + return (int) (62 * SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.mapScaling); } @@ -119,7 +116,7 @@ public class CrystalsHud { } /** - * Converts an X and Z coordinate in the crystal hollow to a X and Y coordinate on the map. + * Converts an X and Z coordinate in the crystal hollow to an X and Y coordinate on the map. * * @param x the world X coordinate * @param z the world Z coordinate @@ -142,8 +139,8 @@ public class CrystalsHud { * Based off code from {@link net.minecraft.client.render.MapRenderer} */ private static float yaw2Cardinal(float yaw) { - yaw += + 180; //flip direction - byte clipped = (byte) ((yaw += yaw < 0.0 ? -8.0 : 8.0) * 16.0 / 360.0); + yaw += 180; //flip direction + byte clipped = (byte) ((yaw + (yaw < 0.0 ? -8.0 : 8.0)) * 16.0 / 360.0); return (clipped * 360f) / 16f; } -- cgit