Remove big int support from ObjectBufferUtils

This commit is contained in:
modmuss50 2021-05-30 14:59:54 +01:00
parent 31e7b357dc
commit 85dbe15590
2 changed files with 1 additions and 25 deletions

View file

@ -52,26 +52,6 @@ public class ExtendedPacketBuffer extends PacketByteBuf {
return ObjectBufferUtils.readObject(this);
}
public void writeBigInt(BigInteger bigInteger) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream outputStream = new ObjectOutputStream(baos);
outputStream.writeObject(bigInteger);
writeByteArray(baos.toByteArray());
} catch (Exception e) {
throw new RuntimeException("Failed to write big int");
}
}
public BigInteger readBigInt() {
try {
ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(readByteArray()));
return (BigInteger) inputStream.readObject();
} catch (Exception e) {
throw new RuntimeException("Failed to read big int");
}
}
// Supports reading and writing list codec's
public <T> void writeCodec(Codec<T> codec, T object) {
DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, object);

View file

@ -79,11 +79,7 @@ public enum ObjectBufferUtils {
COMPOUND_TAG(NbtCompound.class, (value, buffer) -> {
buffer.writeNbt(value);
}, PacketByteBuf::readNbt),
BIG_INT(BigInteger.class, (pos, buffer) -> {
buffer.writeBigInt(pos);
}, ExtendedPacketBuffer::readBigInt);
}, PacketByteBuf::readNbt);
Class clazz;
ObjectWriter writer;