From bd9a99e78ebc39a063d66a828e6a76c8966c5a31 Mon Sep 17 00:00:00 2001 From: Aria Date: Wed, 22 Feb 2023 01:23:33 -0700 Subject: [PATCH] Publish a helper function to the API --- gradle.properties | 2 +- .../dev/zontreck/libzontreck/util/BinUtil.java | 15 +++++++++++++++ src/main/resources/META-INF/mods.toml | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/main/java/dev/zontreck/libzontreck/util/BinUtil.java diff --git a/gradle.properties b/gradle.properties index 5548e31..b91febf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,5 +5,5 @@ org.gradle.daemon=false mc_version=1.19.2 forge_version=43.2.3 -myversion=1.0.4.5 +myversion=1.0.4.6 parchment_version=2022.11.27 \ No newline at end of file diff --git a/src/main/java/dev/zontreck/libzontreck/util/BinUtil.java b/src/main/java/dev/zontreck/libzontreck/util/BinUtil.java new file mode 100644 index 0000000..054532d --- /dev/null +++ b/src/main/java/dev/zontreck/libzontreck/util/BinUtil.java @@ -0,0 +1,15 @@ +package dev.zontreck.libzontreck.util; + +public class BinUtil { + private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); + + public static String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for (int j = 0; j < bytes.length; j++) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = HEX_ARRAY[v >>> 4]; + hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; + } + return new String(hexChars); + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index e465b6e..b5fda02 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="libzontreck" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.0.4.5" #mandatory +version="1.0.4.6" #mandatory # A display name for the mod displayName="LibZontreck" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/