From 4b465e4c95054be8171449c299c4a4455093b129 Mon Sep 17 00:00:00 2001 From: MisterCheezeCake <75341435+MisterCheezeCake@users.noreply.github.com> Date: Tue, 27 Aug 2024 17:11:49 -0400 Subject: [PATCH] Some Fixes --- .../wtf/cheeze/sbt/utils/NumberUtils.java | 3 +- .../utils/actionbar/ActionBarTransformer.java | 4 +-- .../cheeze/sbt/utils/render/RenderUtils.java | 32 ------------------- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/src/main/java/wtf/cheeze/sbt/utils/NumberUtils.java b/src/main/java/wtf/cheeze/sbt/utils/NumberUtils.java index 0385425..8262774 100644 --- a/src/main/java/wtf/cheeze/sbt/utils/NumberUtils.java +++ b/src/main/java/wtf/cheeze/sbt/utils/NumberUtils.java @@ -49,10 +49,11 @@ public static int parseIntWithKorM(String text) { public static float parseFloatWithKorM(String text) { text = text.toLowerCase(); text = text.replaceAll(",", ""); - var v = Float.parseFloat(text.substring(0, text.length() - 1)); if (text.endsWith("k")) { + var v = Float.parseFloat(text.substring(0, text.length() - 1)); return v * 1000; } else if (text.endsWith("m")) { + var v = Float.parseFloat(text.substring(0, text.length() - 1)); return v * 1000000; } else { return Float.parseFloat(text); diff --git a/src/main/java/wtf/cheeze/sbt/utils/actionbar/ActionBarTransformer.java b/src/main/java/wtf/cheeze/sbt/utils/actionbar/ActionBarTransformer.java index 6b86254..4c64bc3 100644 --- a/src/main/java/wtf/cheeze/sbt/utils/actionbar/ActionBarTransformer.java +++ b/src/main/java/wtf/cheeze/sbt/utils/actionbar/ActionBarTransformer.java @@ -31,6 +31,7 @@ import wtf.cheeze.sbt.utils.NumberUtils; import wtf.cheeze.sbt.utils.TextUtils; +import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -174,8 +175,7 @@ public static ActionBarData extractDataAndRunTransformation(String actionBarText data.transformedText = newText; return data; } catch (Exception e) { - SkyblockTweaks.LOGGER.error("Error parsing action bar text: " + actionBarText); - e.printStackTrace(); + SkyblockTweaks.LOGGER.error("Error parsing action bar text: {}", actionBarText, e); SkyblockTweaks.LOGGER.warn("Some features may not work correctly. Please report this to MisterCheezeCake immediately."); return new ActionBarData(); } diff --git a/src/main/java/wtf/cheeze/sbt/utils/render/RenderUtils.java b/src/main/java/wtf/cheeze/sbt/utils/render/RenderUtils.java index 80ef650..7a97d16 100644 --- a/src/main/java/wtf/cheeze/sbt/utils/render/RenderUtils.java +++ b/src/main/java/wtf/cheeze/sbt/utils/render/RenderUtils.java @@ -87,36 +87,4 @@ public static ScreenBounds getScreenBounds() { return new ScreenBounds(); } - // public static class Color4f extends Color3f { -// public float alpha; -// -// private Color4f(int color) { -// super(color); -// this.alpha = (float) (color >> 24 & 255) / 255.0F; -// } -// } -// public static Color4f getColor4f(int color) { -// return new Color4f(color); -// } - // Adapted from Skyblocker -// private static void renderFilledInternal(WorldRenderContext context, Vec3d pos, Vec3d dimensions, Color3f color, float alpha, boolean throughWalls) { -// var matrices = context.matrixStack(); -// var camera = context.camera().getPos(); -// matrices.push(); -// matrices.translate(-camera.x, -camera.y, -camera.z); -// var consumers = context.consumers(); -// var buffer = consumers.getBuffer(throughWalls ? SkyblockerRenderLayers.FILLED_THROUGH_WALLS : SkyblockerRenderLayers.FILLED); -// WorldRenderer.renderFilledBox(matrices, buffer, pos.x, pos.y, pos.z, pos.x + dimensions.x, pos.y + dimensions.y, pos.z + dimensions.z, color.red, color.green, color.blue, alpha); -// matrices.pop(); -// } -// -// -// public static final RenderLayer.MultiPhase FILLED = RenderLayer.of("filled", VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.TRIANGLE_STRIP, RenderLayer.CUTOUT_BUFFER_SIZE, false, true, RenderLayer.MultiPhaseParameters.builder() -// .program(RenderPhase.COLOR_PROGRAM) -// .cull(RenderPhase.Cull.DISABLE_CULLING) -// .layering(RenderPhase.POLYGON_OFFSET_LAYERING) -// .transparency(DEFAULT_TRANSPARENCY) -// .depthTest(RenderPhase.DepthTest.LEQUAL_DEPTH_TEST) -// .build(false)); - }