mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-05-31 21:54:12 +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:
parent
a1221b99e1
commit
e191b08eb5
@ -5,10 +5,10 @@
|
|||||||
*/
|
*/
|
||||||
package dan200.computercraft.shared.util;
|
package dan200.computercraft.shared.util;
|
||||||
|
|
||||||
|
import com.google.common.io.BaseEncoding;
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
import net.minecraft.nbt.*;
|
import net.minecraft.nbt.*;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
import org.apache.commons.codec.binary.Hex;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -25,6 +25,8 @@ import static net.minecraftforge.common.util.Constants.NBT.*;
|
|||||||
|
|
||||||
public final class NBTUtil
|
public final class NBTUtil
|
||||||
{
|
{
|
||||||
|
private static final BaseEncoding ENCODING = BaseEncoding.base16().lowerCase();
|
||||||
|
|
||||||
private NBTUtil() {}
|
private NBTUtil() {}
|
||||||
|
|
||||||
private static INBT toNBTTag( Object object )
|
private static INBT toNBTTag( Object object )
|
||||||
@ -181,7 +183,7 @@ public final class NBTUtil
|
|||||||
DataOutput output = new DataOutputStream( new DigestOutputStream( digest ) );
|
DataOutput output = new DataOutputStream( new DigestOutputStream( digest ) );
|
||||||
CompressedStreamTools.write( tag, output );
|
CompressedStreamTools.write( tag, output );
|
||||||
byte[] hash = digest.digest();
|
byte[] hash = digest.digest();
|
||||||
return new String( Hex.encodeHex( hash ) );
|
return ENCODING.encode( hash );
|
||||||
}
|
}
|
||||||
catch( NoSuchAlgorithmException | IOException e )
|
catch( NoSuchAlgorithmException | IOException e )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user