diff options
| author | viciscat <51047087+viciscat@users.noreply.github.com> | 2024-11-20 20:22:10 +0100 |
|---|---|---|
| committer | viciscat <51047087+viciscat@users.noreply.github.com> | 2024-12-12 18:22:43 +0100 |
| commit | e1ceed73b69cf11f3e2806db21461b2c0ad4adc1 (patch) | |
| tree | 328559b5f8dd115192a0dab2c4b1895a427f7a6a /src/main/java | |
| parent | ad1115ac407d4d10ac1fdb762387d13ed344f49c (diff) | |
| download | Skyblocker-e1ceed73b69cf11f3e2806db21461b2c0ad4adc1.tar.gz Skyblocker-e1ceed73b69cf11f3e2806db21461b2c0ad4adc1.tar.bz2 Skyblocker-e1ceed73b69cf11f3e2806db21461b2c0ad4adc1.zip | |
the whitespace commit
Diffstat (limited to 'src/main/java')
61 files changed, 2832 insertions, 2888 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java index eaaab35b..3ed0b335 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java @@ -57,47 +57,6 @@ public class MiningCategory { .build()) .build()) - //Dwarven HUD - // TODO remove - .group(OptionGroup.createBuilder() - .name(Text.translatable("skyblocker.config.mining.dwarvenHud")) - .collapsed(false) - .option(LabelOption.create(Text.literal("Use the hypixel widget."))) - .option(Option.<Boolean>createBuilder() - .name(Text.translatable("skyblocker.config.mining.dwarvenHud.enabledCommissions")) - .binding(defaults.mining.dwarvenHud.enabledCommissions, - () -> config.mining.dwarvenHud.enabledCommissions, - newValue -> config.mining.dwarvenHud.enabledCommissions = newValue) - .controller(ConfigUtils::createBooleanController) - .available(false) - .build()) - .option(Option.<Boolean>createBuilder() - .name(Text.translatable("skyblocker.config.mining.dwarvenHud.enabledPowder")) - .binding(defaults.mining.dwarvenHud.enabledPowder, - () -> config.mining.dwarvenHud.enabledPowder, - newValue -> config.mining.dwarvenHud.enabledPowder = newValue) - .controller(ConfigUtils::createBooleanController) - .available(false) - .build()) - .option(Option.<MiningConfig.DwarvenHudStyle>createBuilder() - .name(Text.translatable("skyblocker.config.mining.dwarvenHud.style")) - .description(OptionDescription.of(Text.translatable("skyblocker.config.mining.dwarvenHud.style.@Tooltip[0]"), - Text.translatable("skyblocker.config.mining.dwarvenHud.style.@Tooltip[1]"), - Text.translatable("skyblocker.config.mining.dwarvenHud.style.@Tooltip[2]"))) - .binding(defaults.mining.dwarvenHud.style, - () -> config.mining.dwarvenHud.style, - newValue -> config.mining.dwarvenHud.style = newValue) - .controller(ConfigUtils::createEnumCyclingListController) - .available(false) - .build()) - .option(ButtonOption.createBuilder() - .name(Text.translatable("skyblocker.config.mining.dwarvenHud.screen")) - .text(Text.translatable("text.skyblocker.open")) - .action((screen, opt) -> screen.tick()) - .available(false) - .build()) - .build()) - //Crystal Hollows .group(OptionGroup.createBuilder() .name(Text.translatable("skyblocker.config.mining.crystalHollows")) diff --git a/src/main/java/de/hysky/skyblocker/config/configs/UIAndVisualsConfig.java b/src/main/java/de/hysky/skyblocker/config/configs/UIAndVisualsConfig.java index 142fb8f4..21b58a33 100644 --- a/src/main/java/de/hysky/skyblocker/config/configs/UIAndVisualsConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/configs/UIAndVisualsConfig.java @@ -165,16 +165,8 @@ public class UIAndVisualsConfig { @SerialEntry public boolean effectsFromFooter = false; - @Deprecated - @SerialEntry - public boolean plainPlayerNames = false; - @SerialEntry public ScreenBuilder.DefaultPositioner defaultPositioning = ScreenBuilder.DefaultPositioner.CENTERED; - - @Deprecated - @SerialEntry - public NameSorting nameSorting = NameSorting.DEFAULT; } public enum NameSorting { diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudWidget.java index 122f6c6e..78cc2c1f 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudWidget.java @@ -21,52 +21,52 @@ import java.util.Set; @RegisterWidget public class CrystalsHudWidget extends HudWidget { - private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); - protected static final Identifier MAP_TEXTURE = Identifier.of(SkyblockerMod.NAMESPACE, "textures/gui/crystals_map.png"); - private static final Identifier MAP_ICON = Identifier.ofVanilla("textures/map/decorations/player.png"); - private static final List<String> SMALL_LOCATIONS = List.of("Fairy Grotto", "King Yolkar", "Corleone", "Odawa", "Key Guardian", "Unknown"); + private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); + protected static final Identifier MAP_TEXTURE = Identifier.of(SkyblockerMod.NAMESPACE, "textures/gui/crystals_map.png"); + private static final Identifier MAP_ICON = Identifier.ofVanilla("textures/map/decorations/player.png"); + private static final List<String> SMALL_LOCATIONS = List.of("Fairy Grotto", "King Yolkar", "Corleone", "Odawa", "Key Guardian", "Unknown"); - private static CrystalsHudWidget instance = null; + private static CrystalsHudWidget instance = null; public static CrystalsHudWidget getInstance() { if (instance == null) new CrystalsHudWidget(); return instance; } - public CrystalsHudWidget() { - super("hud_crystals"); + public CrystalsHudWidget() { + super("hud_crystals"); instance = this; - } - - /** - * 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 - * @return a vector representing the x and y values - */ - protected static Vector2ic transformLocation(double x, double z) { - //converts an x and z to a location on the map - int transformedX = (int) ((x - 202) / 621 * 62); - int transformedY = (int) ((z - 202) / 621 * 62); - transformedX = Math.clamp(transformedX, 0, 62); - transformedY = Math.clamp(transformedY, 0, 62); - - return new Vector2i(transformedX, transformedY); - } - - /** - * Converts yaw to the cardinal directions that a player marker can be rotated towards on a map. - * The rotations of a marker follow this order: N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW. - * <br><br> - * 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); - - return (clipped * 360f) / 16f; - } + } + + /** + * 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 + * @return a vector representing the x and y values + */ + protected static Vector2ic transformLocation(double x, double z) { + //converts an x and z to a location on the map + int transformedX = (int) ((x - 202) / 621 * 62); + int transformedY = (int) ((z - 202) / 621 * 62); + transformedX = Math.clamp(transformedX, 0, 62); + transformedY = Math.clamp(transformedY, 0, 62); + + return new Vector2i(transformedX, transformedY); + } + + /** + * Converts yaw to the cardinal directions that a player marker can be rotated towards on a map. + * The rotations of a marker follow this order: N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW. + * <br><br> + * 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); + + return (clipped * 360f) / 16f; + } @Override public Set<Location> availableLocations() { @@ -74,9 +74,9 @@ public class CrystalsHudWidget extends HudWidget { } @Override - public boolean isEnabledIn(Location location) { - return location.equals(Location.CRYSTAL_HOLLOWS) && SkyblockerConfigManager.get().mining.crystalsHud.enabled; - } + public boolean isEnabledIn(Location location) { + return location.equals(Location.CRYSTAL_HOLLOWS) && SkyblockerConfigManager.get().mining.crystalsHud.enabled; + } @Override public void setEnabledIn(Location location, boolean enabled) { @@ -85,68 +85,69 @@ public class CrystalsHudWidget extends HudWidget { } public void update() { - if (CLIENT.player == null || CLIENT.getNetworkHandler() == null || !SkyblockerConfigManager.get().mining.crystalsHud.enabled) return; - - - //get if the player is in the crystals - float scale = SkyblockerConfigManager.get().mining.crystalsHud.mapScaling; - w = h = (int) (62 * scale); - } - - @Override - public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) { - float scale = SkyblockerConfigManager.get().mining.crystalsHud.mapScaling; - - //make sure the map renders infront of some stuff - improve this in the future with better layering (1.20.5?) - //and set position and scale - MatrixStack matrices = context.getMatrices(); - matrices.push(); - matrices.translate(x, y, 0f); - matrices.scale(scale, scale, 0f); - w = h = (int) (62 * scale); - - //draw map texture - context.drawTexture(RenderLayer::getGuiTextured, MAP_TEXTURE, 0, 0, 0, 0, 62, 62, 62, 62); - - //if enabled add waypoint locations to map - if (SkyblockerConfigManager.get().mining.crystalsHud.showLocations) { - for (MiningLocationLabel waypoint : CrystalsLocationsManager.activeWaypoints.values()) { - MiningLocationLabel.Category category = waypoint.category(); - Vector2ic renderPos = transformLocation(waypoint.centerPos.getX(), waypoint.centerPos.getZ()); - int locationSize = SkyblockerConfigManager.get().mining.crystalsHud.locationSize; - - if (SMALL_LOCATIONS.contains(category.getName())) {//if small location half the location size - locationSize /= 2; - } - - //fill square of size locationSize around the coordinates of the location - context.fill(renderPos.x() - locationSize / 2, renderPos.y() - locationSize / 2, renderPos.x() + locationSize / 2, renderPos.y() + locationSize / 2, category.getColor()); - } - } - - //draw player on map - if (CLIENT.player == null || CLIENT.getNetworkHandler() == null) { - matrices.pop(); - return; - } - //get player location - double playerX = CLIENT.player.getX(); - double playerZ = CLIENT.player.getZ(); - float playerRotation = CLIENT.player.getYaw(); //TODO make the transitions more rough? - Vector2ic renderPos = transformLocation(playerX, playerZ); - - int renderX = renderPos.x() - 2; - int renderY = renderPos.y() - 3; - - //position, scale and rotate the player marker - matrices.translate(renderX, renderY, 0f); - matrices.scale(0.75f, 0.75f, 0f); - matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(yaw2Cardinal(playerRotation)), 2.5f, 3.5f, 0); - - //draw marker on map - context.drawTexture(RenderLayer::getGuiTextured, MAP_ICON, 0, 0, 2, 0, 5, 7, 8, 8); - matrices.pop(); - } + if (CLIENT.player == null || CLIENT.getNetworkHandler() == null || !SkyblockerConfigManager.get().mining.crystalsHud.enabled) return; + + + //get if the player is in the crystals + float scale = SkyblockerConfigManager.get().mining.crystalsHud.mapScaling; + w = h = (int) (62 * scale); + } + + @Override + public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) { + float scale = SkyblockerConfigManager.get().mining.crystalsHud.mapScaling; + + //make sure the map renders infront of some stuff - improve this in the future with better layering (1.20.5?) + //and set position and scale + MatrixStack matrices = context.getMatrices(); + matrices.push(); + matrices.translate(x, y, 0f); + matrices.scale(scale, scale, 0f); + w = h = (int) (62 * scale); + + //draw map texture + context.drawTexture(RenderLayer::getGuiTextured, MAP_TEXTURE, 0, 0, 0, 0, 62, 62, 62, 62); + + //if enabled add waypoint locations to map + if (SkyblockerConfigManager.get().mining.crystalsHud.showLocations) { + for (MiningLocationLabel waypoint : CrystalsLocationsManager.activeWaypoints.values()) { + + MiningLocationLabel.Category category = waypoint.category(); + Vector2ic renderPos = transformLocation(waypoint.centerPos.getX(), waypoint.centerPos.getZ()); + int locationSize = SkyblockerConfigManager.get().mining.crystalsHud.locationSize; + + if (SMALL_LOCATIONS.contains(category.getName())) {//if small location half the location size + locationSize /= 2; + } + + //fill square of size locationSize around the coordinates of the location + context.fill(renderPos.x() - locationSize / 2, renderPos.y() - locationSize / 2, renderPos.x() + locationSize / 2, renderPos.y() + locationSize / 2, category.getColor()); + } + } + + //draw player on map + if (CLIENT.player == null || CLIENT.getNetworkHandler() == null) { + matrices.pop(); + return; + } + //get player location + double playerX = CLIENT.player.getX(); + double playerZ = CLIENT.player.getZ(); + float playerRotation = CLIENT.player.getYaw(); //TODO make the transitions more rough? + Vector2ic renderPos = transformLocation(playerX, playerZ); + + int renderX = renderPos.x() - 2; + int renderY = renderPos.y() - 3; + + //position, scale and rotate the player marker + matrices.translate(renderX, renderY, 0f); + matrices.scale(0.75f, 0.75f, 0f); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(yaw2Cardinal(playerRotation)), 2.5f, 3.5f, 0); + + //draw marker on map + context.drawTexture(RenderLayer::getGuiTextured, MAP_ICON, 0, 0, 2, 0, 5, 7, 8, 8); + matrices.pop(); + } @Override public Text getDisplayName() { diff --git a/src/main/java/de/hysky/skyblocker/skyblock/end/EndHudWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/end/EndHudWidget.java index fdf5b785..1e0ddc00 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/end/EndHudWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/end/EndHudWidget.java @@ -22,36 +22,37 @@ import java.util.Set; @RegisterWidget public class EndHudWidget extends ComponentBasedWidget { - private static final MutableText TITLE = Text.literal("The End").formatted(Formatting.LIGHT_PURPLE, Formatting.BOLD); + private static final MutableText TITLE = Text.literal("The End").formatted(Formatting.LIGHT_PURPLE, Formatting.BOLD); - private static EndHudWidget instance = null; + private static |
