mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-11-04 07:32:59 +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:
		@@ -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 )
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user