1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 12:10:30 +00:00

Use Guava instead of commons-codec for hex encoding

The latter was removed in 1.18 on the server side.

Fixes #1011.
This commit is contained in:
Jonathan Coates 2022-01-14 15:33:47 +00:00
parent a1221b99e1
commit e191b08eb5
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -5,10 +5,10 @@
*/
package dan200.computercraft.shared.util;
import com.google.common.io.BaseEncoding;
import dan200.computercraft.ComputerCraft;
import net.minecraft.nbt.*;
import net.minecraftforge.common.util.Constants;
import org.apache.commons.codec.binary.Hex;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -25,6 +25,8 @@ import static net.minecraftforge.common.util.Constants.NBT.*;
public final class NBTUtil
{
private static final BaseEncoding ENCODING = BaseEncoding.base16().lowerCase();
private NBTUtil() {}
private static INBT toNBTTag( Object object )
@ -181,7 +183,7 @@ public final class NBTUtil
DataOutput output = new DataOutputStream( new DigestOutputStream( digest ) );
CompressedStreamTools.write( tag, output );
byte[] hash = digest.digest();
return new String( Hex.encodeHex( hash ) );
return ENCODING.encode( hash );
}
catch( NoSuchAlgorithmException | IOException e )
{