diff options
author | vicisacat <victor.branchu@gmail.com> | 2024-04-18 22:24:28 +0200 |
---|---|---|
committer | vicisacat <victor.branchu@gmail.com> | 2024-04-20 16:10:17 +0200 |
commit | 007c58424de0bc44cca9faf77185e0ce9e7b2234 (patch) | |
tree | 302ea31996b009db9bbbae7ed6005b7beef23255 /src/main | |
parent | 25032b8804e00343a0f0b7fec774ce0954d2c88d (diff) | |
download | Skyblocker-007c58424de0bc44cca9faf77185e0ce9e7b2234.tar.gz Skyblocker-007c58424de0bc44cca9faf77185e0ce9e7b2234.tar.bz2 Skyblocker-007c58424de0bc44cca9faf77185e0ce9e7b2234.zip |
formatting and things
fix silly intelliJ refactoring random strings
delete unused BarGrid.java why is this even here still
Diffstat (limited to 'src/main')
11 files changed, 11 insertions, 151 deletions
diff --git a/src/main/java/de/hysky/skyblocker/mixin/WindowMixin.java b/src/main/java/de/hysky/skyblocker/mixin/WindowMixin.java index 474b2577..481a70a6 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/WindowMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/WindowMixin.java @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Window.class) public class WindowMixin { @Inject(method = "setScaleFactor", at = @At("TAIL")) - public void onScaleFactorChange(double scaleFactor, CallbackInfo ci) { + public void skyblocker$onScaleFactorChange(double scaleFactor, CallbackInfo ci) { FancyStatusBars.updatePositions(); } } diff --git a/src/main/java/de/hysky/skyblocker/mixin/accessor/DrawContextInvoker.java b/src/main/java/de/hysky/skyblocker/mixin/accessor/DrawContextInvoker.java index bb201dce..9c14fdc6 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/accessor/DrawContextInvoker.java +++ b/src/main/java/de/hysky/skyblocker/mixin/accessor/DrawContextInvoker.java @@ -15,6 +15,7 @@ public interface DrawContextInvoker { @Invoker void invokeDrawTooltip(TextRenderer textRenderer, List<TooltipComponent> components, int x, int y, TooltipPositioner positioner); + @Invoker void invokeDrawTexturedQuad(Identifier texture, int x1, int x2, int y1, int y2, int z, float u1, float u2, float v1, float v2, float red, float green, float blue, float alpha); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRule.java b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRule.java index 65cbde5b..34cc6352 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRule.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRule.java @@ -235,7 +235,7 @@ public class ChatRule { String rawLocation = Utils.getLocationRaw(); Boolean isLocationValid = null; - for (String validLocation : validLocations.replace(" ", "").toLowerCase().split(",")) {//the locations are raw locations targetSize by "," and start with ! if not locations + for (String validLocation : validLocations.replace(" ", "").toLowerCase().split(",")) {//the locations are raw locations split by "," and start with ! if not locations String rawValidLocation = ChatRulesHandler.locations.get(validLocation.replace("!","")); if (rawValidLocation == null) continue; if (validLocation.startsWith("!")) {//not location diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java index 3d373025..617e7094 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java @@ -117,7 +117,7 @@ public class DungeonMapUtils { * @param mapEntrancePos the map position of the top left corner of the entrance * @param mapRoomSize the size of a room on the map * @return the map position of the top left corner of the room the player is in - * @implNote {@code mapPos} is shifted by 2 so room borders are evenly targetSize. + * @implNote {@code mapPos} is shifted by 2 so room borders are evenly split. * {@code mapPos} is then shifted by {@code offset} to align the top left most room at (0, 0) * so subtracting the modulo will give the top left corner of the room shifted by {@code offset}. * Finally, {@code mapPos} is shifted back by {@code offset} to its intended position. diff --git a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/BarGrid.java b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/BarGrid.java deleted file mode 100644 index 384250f9..00000000 --- a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/BarGrid.java +++ /dev/null @@ -1,136 +0,0 @@ -package de.hysky.skyblocker.skyblock.fancybars; - -import java.util.LinkedList; -import java.util.List; - -public class BarGrid { - private final LinkedList<LinkedList<StatusBar>> top = new LinkedList<>(); - private final LinkedList<LinkedList<StatusBar>> bottomLeft = new LinkedList<>(); - private final LinkedList<LinkedList<StatusBar>> bottomRight = new LinkedList<>(); - - public BarGrid() {} - - public void add(int row, StatusBar bar, boolean right) { - if (row > 0) - top.get(row).add(bar); - else if (row < 0) { - if (right) { - bottomRight.get(Math.abs(row)).add(bar); - } else { - bottomLeft.get(Math.abs(row)).add(bar); - } - } - } - - public void add(int x, int y, StatusBar bar) { - if (y > 0) { - if (x < 1) throw new IllegalArgumentException("x can't be negative, x: " + x); - LinkedList<StatusBar> statusBars = top.get(y-1); - statusBars.add(Math.min(x-1, statusBars.size()), bar); - bar.gridY = y; - bar.gridX = statusBars.indexOf(bar)+1; - } else if (y < 0) { - LinkedList<StatusBar> statusBars = (x < 0? bottomLeft: bottomRight).get(Math.abs(y)-1); - statusBars.add(Math.min(Math.abs(x)-1, statusBars.size()), bar); - bar.gridY = y; - bar.gridX = (int) ((statusBars.indexOf(bar)+1) * Math.signum(x)); - } - } - - public List<StatusBar> getRow(int row, boolean right) { - if (row > 0) { - return top.get(row-1); - } else { - return (right ? bottomRight: bottomLeft).get(Math.abs(row)-1); - } - } - - public void addRow(int row, boolean right) { - if (row>0) { - top.add(row-1, new LinkedList<>()); - } else if (row<0) { - (right ? bottomRight: bottomLeft).add(Math.abs(row)-1, new LinkedList<>()); - } - } - - public void addRowToEnd(boolean top, boolean right) { - if (top) { - this.top.add(new LinkedList<>()); - } else { - (right ? bottomRight: bottomLeft).add(new LinkedList<>()); - } - } - - public void addToEndOfRow(int row, boolean right, StatusBar bar) { - if (row>0) { - LinkedList<StatusBar> statusBars = top.get(row - 1); - statusBars.add(bar); - bar.gridY = row; - bar.gridX = statusBars.indexOf(bar)+1; - } else if (row<0) { - LinkedList<StatusBar> statusBars = (right? bottomRight: bottomLeft).get(Math.abs(row)-1); - statusBars.add(bar); - bar.gridY = row; - bar.gridX = (statusBars.indexOf(bar)+1) * (right ? 1: -1); - } - } - - public void remove(int x, int y) { - System.out.println("Removing x: " + x + " y: " + y); - if (y > 0) { - if (x < 1) throw new IllegalArgumentException("x can't be negative, x: " + x); - LinkedList<StatusBar> statusBars = top.get(y-1); - StatusBar remove = statusBars.remove(x-1); - for (int i = x-1; i < statusBars.size(); i++) { - statusBars.get(i).gridX--; - } - remove.gridX = 0; - remove.gridY = 0; - if (statusBars.isEmpty()) { - top.remove(y - 1); - for (int i = y-1; i < top.size(); i++) { - for (StatusBar bar : top.get(i)) { - bar.gridY--; - } - } - } - } else if (y < 0) { - LinkedList<LinkedList<StatusBar>> bottom = x < 0 ? bottomLeft : bottomRight; - LinkedList<StatusBar> statusBars = bottom.get(Math.abs(y)-1); - StatusBar remove = statusBars.remove(Math.abs(x) - 1); - for (int i = Math.abs(x)-1; i < statusBars.size(); i++) { - statusBars.get(i).gridX--; - } - remove.gridX = 0; - remove.gridY = 0; - if (statusBars.isEmpty()) { - bottom.remove(Math.abs(y) - 1); - for (int i = Math.abs(y)-1; i < bottom.size(); i++) { - for (StatusBar bar : bottom.get(i)) { - bar.gridY--; - } - } - } - } - } - - public boolean coordinatesExist(int x, int y) { - if (x == 0 || y == 0) return false; - if (y > 0) { - if (y > getTopSize()) return false; - return x <= getRow(y, false).size(); - } else { - if (Math.abs(y) > (x < 0 ? getBottomLeftSize(): getBottomRightSize())) return false; - return Math.abs(x) <= getRow(y, x > 0).size(); - } - } - - public StatusBar getBar(int x, int y) { - return getRow(y, x>0).get(Math.abs(x)-1); - } - - public int getTopSize() {return top.size();} - - public int getBottomLeftSize() {return bottomLeft.size();} - public int getBottomRightSize() {return bottomRight.size();} -} diff --git a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/BarPositioner.java b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/BarPositioner.java index 7fde9117..3b5b865b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/BarPositioner.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/BarPositioner.java @@ -175,8 +175,7 @@ public class BarPositioner { SCREEN_BOTTOM_RIGHT(true, false, ((scaledWidth, scaledHeight) -> new ScreenPos(scaledWidth - 5, scaledHeight - 5)), SizeRule.freeSize(25, 2, 6) - ), - ; + ); private final AnchorPositionProvider positionProvider; private final AnchorHitboxProvider hitboxProvider; @@ -256,8 +255,7 @@ public class BarPositioner { * @param minSize the minimum (free and target size) * @param maxSize the maximum (free and target size, THIS SHOULD BE THE SAME AS {@code targetSize} FOR {@code isTargetSize = true}) */ - public record SizeRule(boolean isTargetSize, int targetSize, int totalWidth, int widthPerSize, int minSize, - int maxSize) { + public record SizeRule(boolean isTargetSize, int targetSize, int totalWidth, int widthPerSize, int minSize, int maxSize) { public static SizeRule freeSize(int widthPerSize, int minSize, int maxSize) { return new SizeRule(false, -1, -1, widthPerSize, minSize, maxSize); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/EditBarColorPopup.java b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/EditBarColorPopup.java index a3ce4e43..64e79bab 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/EditBarColorPopup.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/EditBarColorPopup.java @@ -105,7 +105,7 @@ public class EditBarColorPopup extends AbstractPopupScreen { @Override public void setX(int x) { super.setX(x); - textFieldWidget.setX(getX()+16); + textFieldWidget.setX(getX() + 16); } @Override diff --git a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/FancyStatusBars.java b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/FancyStatusBars.java index 0595dda9..a87871be 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/FancyStatusBars.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/FancyStatusBars.java @@ -250,8 +250,6 @@ public class FancyStatusBars { } } - public FancyStatusBars() {} - public boolean render(DrawContext context, int scaledWidth, int scaledHeight) { var player = client.player; if (!SkyblockerConfigManager.get().general.bars.enableBars || player == null || Utils.isInTheRift()) @@ -273,5 +271,5 @@ public class FancyStatusBars { statusBars.get("defense").updateValues(defense / (defense + 100.f), 0, defense); statusBars.get("experience").updateValues(player.experienceProgress, 0, player.experienceLevel); return true; - } + } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBar.java b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBar.java index 5ece1934..8a38be09 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBar.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBar.java @@ -119,7 +119,7 @@ public class StatusBar implements Widget, Drawable, Element, Selectable { public void render(DrawContext context, int mouseX, int mouseY, float delta) { if (width <= 0) return; // half works lol. only puts transparency on the filler of the bar - if (ghost) context.setShaderColor(1f,1f,1f,0.25f); + if (ghost) context.setShaderColor(1f, 1f, 1f, 0.25f); switch (iconPosition) { case LEFT -> context.drawGuiTexture(icon, x, y, 9, 9); case RIGHT -> context.drawGuiTexture(icon, x + width - 9, y, 9, 9); @@ -134,7 +134,7 @@ public class StatusBar implements Widget, Drawable, Element, Selectable { if (hasOverflow && overflowFill > 0) { RenderHelper.renderNineSliceColored(context, BAR_FILL, barX + 1, y + 2, (int) ((barWith - 2) * overflowFill), 5, colors[1]); } - if (ghost) context.setShaderColor(1f,1f,1f,1f); + if (ghost) context.setShaderColor(1f, 1f, 1f, 1f); //context.drawText(MinecraftClient.getInstance().textRenderer, gridX + " " + gridY + " s:" + size , x, y-9, Colors.WHITE, true); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBarsConfigScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBarsConfigScreen.java index 00231ec8..e49cc7fe 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBarsConfigScreen.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/fancybars/StatusBarsConfigScreen.java @@ -23,7 +23,6 @@ import java.util.HashMap; import java.util.Map; public class StatusBarsConfigScreen extends Screen { - private static final Identifier HOTBAR_TEXTURE = new Identifier("hud/hotbar"); public static final long RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java b/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java index c5811dd2..1d740601 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java @@ -318,7 +318,7 @@ public class SearchOverManager { } /** - * pushes the ({@link SearchOverManager#search}) to the sign. It needs to targetSize it over two lines without splitting a word + * pushes the ({@link SearchOverManager#search}) to the sign. It needs to split it over two lines without splitting a word */ private static void pushSign() { //splits text into 2 lines max = 30 chars |