From 85dbe1559073565aca3729408f2700e16f1d2b34 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 30 May 2021 14:59:54 +0100 Subject: [PATCH] Remove big int support from ObjectBufferUtils --- .../common/network/ExtendedPacketBuffer.java | 20 ------------------- .../common/network/ObjectBufferUtils.java | 6 +----- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/RebornCore/src/main/java/reborncore/common/network/ExtendedPacketBuffer.java b/RebornCore/src/main/java/reborncore/common/network/ExtendedPacketBuffer.java index b87c5aaf9..6e5d29f62 100644 --- a/RebornCore/src/main/java/reborncore/common/network/ExtendedPacketBuffer.java +++ b/RebornCore/src/main/java/reborncore/common/network/ExtendedPacketBuffer.java @@ -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 void writeCodec(Codec codec, T object) { DataResult dataResult = codec.encodeStart(NbtOps.INSTANCE, object); diff --git a/RebornCore/src/main/java/reborncore/common/network/ObjectBufferUtils.java b/RebornCore/src/main/java/reborncore/common/network/ObjectBufferUtils.java index 0091d62f9..b4dceabf9 100644 --- a/RebornCore/src/main/java/reborncore/common/network/ObjectBufferUtils.java +++ b/RebornCore/src/main/java/reborncore/common/network/ObjectBufferUtils.java @@ -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;