From 8aa891812473ef67a62ed4ab15d4fcf53abc7124 Mon Sep 17 00:00:00 2001 From: rycbar0 Date: Mon, 26 Sep 2022 22:23:38 +0200 Subject: [PATCH] codacy issue #1 and #5 fix --- .../format/defaults/LitematicaSchematic.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java b/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java index defbd3ea..8aea77a5 100644 --- a/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java +++ b/src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java @@ -37,7 +37,9 @@ import java.util.*; * */ public final class LitematicaSchematic extends StaticSchematic { - int minX=0,minY=0,minZ=0; + int minX=0; + int minY=0; + int minZ=0; private static final String reg = "Regions"; private static final String meta = "Metadata"; private static final String schemSize = "EnclosingSize"; @@ -277,6 +279,7 @@ public final class LitematicaSchematic extends StaticSchematic { public static long roundUp(long number, long interval) { + int sign = 1; if (interval == 0) { return 0; @@ -289,11 +292,11 @@ public final class LitematicaSchematic extends StaticSchematic { { if (number < 0) { - interval *= -1; + sign = -1; } - long i = number % interval; - return i == 0 ? number : number + interval - i; + long i = number % (interval * sign); + return i == 0 ? number : number + (interval * sign) - i; } } }