Remove big int support from ObjectBufferUtils
This commit is contained in:
parent
31e7b357dc
commit
85dbe15590
2 changed files with 1 additions and 25 deletions
|
@ -52,26 +52,6 @@ public class ExtendedPacketBuffer extends PacketByteBuf {
|
||||||
return ObjectBufferUtils.readObject(this);
|
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
|
// Supports reading and writing list codec's
|
||||||
public <T> void writeCodec(Codec<T> codec, T object) {
|
public <T> void writeCodec(Codec<T> codec, T object) {
|
||||||
DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, object);
|
DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, object);
|
||||||
|
|
|
@ -79,11 +79,7 @@ public enum ObjectBufferUtils {
|
||||||
|
|
||||||
COMPOUND_TAG(NbtCompound.class, (value, buffer) -> {
|
COMPOUND_TAG(NbtCompound.class, (value, buffer) -> {
|
||||||
buffer.writeNbt(value);
|
buffer.writeNbt(value);
|
||||||
}, PacketByteBuf::readNbt),
|
}, PacketByteBuf::readNbt);
|
||||||
|
|
||||||
BIG_INT(BigInteger.class, (pos, buffer) -> {
|
|
||||||
buffer.writeBigInt(pos);
|
|
||||||
}, ExtendedPacketBuffer::readBigInt);
|
|
||||||
|
|
||||||
Class clazz;
|
Class clazz;
|
||||||
ObjectWriter writer;
|
ObjectWriter writer;
|
||||||
|
|
Loading…
Reference in a new issue