From 6882678bc4404e63c01f566d64fec644189d83d6 Mon Sep 17 00:00:00 2001 From: _tomcraft <936063+tomcraft@users.noreply.github.com> Date: Sun, 29 Nov 2020 21:31:18 +0100 Subject: [PATCH] Reduce useless List operations (#2214) --- .../src/main/java/us/myles/ViaVersion/api/PacketWrapper.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java index de6154a7a..34689eaca 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java +++ b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java @@ -487,11 +487,8 @@ public class PacketWrapper { * Reset the reader, so that it can be read again. */ public void resetReader() { - // Move readable objects are packet values - this.packetValues.addAll(readableObjects); - this.readableObjects.clear(); // Move all packet values to the readable for next packet. - this.readableObjects.addAll(packetValues); + this.readableObjects.addAll(0, packetValues); this.packetValues.clear(); }