From b3cd7fc2d0b8266196116c54635ec6f48c6c428e Mon Sep 17 00:00:00 2001 From: Colton Date: Sun, 8 Dec 2024 20:25:33 -0500 Subject: [PATCH] UI margin tweaks --- src/main/java/net/aoba/gui/components/BlocksComponent.java | 6 +++--- src/main/java/net/aoba/gui/components/ListComponent.java | 4 ++-- src/main/java/net/aoba/gui/components/ModuleComponent.java | 2 +- src/main/java/net/aoba/utils/render/Render2D.java | 2 -- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/aoba/gui/components/BlocksComponent.java b/src/main/java/net/aoba/gui/components/BlocksComponent.java index 3aee383..a33c5ff 100644 --- a/src/main/java/net/aoba/gui/components/BlocksComponent.java +++ b/src/main/java/net/aoba/gui/components/BlocksComponent.java @@ -63,7 +63,7 @@ public BlocksComponent(BlocksSetting setting) { this.text = setting.displayName; blocks = setting; - this.setMargin(new Margin(4f, null, 4f, null)); + this.setMargin(new Margin(8f, 2f, 8f, 2f)); } @Override @@ -73,8 +73,8 @@ public void measure(Size availableSize) { else preferredSize = new Size(availableSize.getWidth(), EXPANDED_HEIGHT); - visibleColumns = (int) Math.floor((preferredSize.getWidth()) / BLOCK_WIDTH) - 1; - visibleRows = (int) Math.floor((preferredSize.getHeight() - 25) / BLOCK_WIDTH); + visibleColumns = (int) Math.floor((preferredSize.getWidth()) / (BLOCK_WIDTH + BLOCK_MARGIN)); + visibleRows = (int) Math.floor((preferredSize.getHeight() - 25) / (BLOCK_WIDTH + BLOCK_MARGIN)); } /** diff --git a/src/main/java/net/aoba/gui/components/ListComponent.java b/src/main/java/net/aoba/gui/components/ListComponent.java index 8bfa803..4d26f81 100644 --- a/src/main/java/net/aoba/gui/components/ListComponent.java +++ b/src/main/java/net/aoba/gui/components/ListComponent.java @@ -40,14 +40,14 @@ public class ListComponent extends Component implements MouseClickListener { public ListComponent(List itemsSource) { super(); - this.setMargin(new Margin(2f, null, 2f, null)); + this.setMargin(new Margin(8f, 2f, 8f, 2f)); this.itemsSource = itemsSource; } public ListComponent(List itemsSource, StringSetting listSetting) { super(); this.listSetting = listSetting; - this.setMargin(new Margin(2f, null, 2f, null)); + this.setMargin(new Margin(8f, 2f, 8f, 2f)); this.itemsSource = itemsSource; } diff --git a/src/main/java/net/aoba/gui/components/ModuleComponent.java b/src/main/java/net/aoba/gui/components/ModuleComponent.java index 0e65777..4cb8bdc 100644 --- a/src/main/java/net/aoba/gui/components/ModuleComponent.java +++ b/src/main/java/net/aoba/gui/components/ModuleComponent.java @@ -56,7 +56,7 @@ public ModuleComponent(Module module) { this.header = module.getName(); this.module = module; this.tooltip = module.getDescription(); - this.setMargin(new Margin(8f, null, 8f, null)); + this.setMargin(new Margin(8f, 2f, 8f, 2f)); } @Override diff --git a/src/main/java/net/aoba/utils/render/Render2D.java b/src/main/java/net/aoba/utils/render/Render2D.java index 6627be8..37854a3 100644 --- a/src/main/java/net/aoba/utils/render/Render2D.java +++ b/src/main/java/net/aoba/utils/render/Render2D.java @@ -9,7 +9,6 @@ import net.aoba.AobaClient; import net.aoba.gui.Rectangle; import net.aoba.gui.colors.Color; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gl.ShaderProgramKeys; import net.minecraft.client.gui.DrawContext; @@ -699,7 +698,6 @@ public static void drawVerticalGradient(Matrix4f matrix4f, float x, float y, flo * @param y Y position to draw the item. */ public static void drawItem(DrawContext drawContext, ItemStack stack, float x, float y) { - MinecraftClient MC = MinecraftClient.getInstance(); drawContext.drawItem(stack, (int) x, (int) y); }