From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ivan Pekov Date: Thu, 8 Oct 2020 20:48:54 +0300 Subject: [PATCH] Use GlueList for some list initialisations in packets diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java index 57de1f541107ec3c53abb5a2c02ba579bc03f7ab..3ebd70b7072c5253c1f533f6b1e1dade26c4ebe6 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -211,7 +211,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { if (extra == null || extra.isEmpty()) { return null; } - java.util.List ret = new java.util.ArrayList<>(1 + extra.size()); + java.util.List ret = new net.yatopia.server.list.GlueList<>(1 + extra.size()); // Yatopia buildExtraPackets0(extra, ret); return ret; } @@ -264,7 +264,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { if (!hasExtraPackets) { this.packetQueue.add(new NetworkManager.QueuedPacket(packet, genericfuturelistener)); } else { - java.util.List packets = new java.util.ArrayList<>(1 + extraPackets.size()); + java.util.List packets = new net.yatopia.server.list.GlueList<>(1 + extraPackets.size()); // Yatopia packets.add(new NetworkManager.QueuedPacket(packet, null)); // delay the future listener until the end of the extra packets for (int i = 0, len = extraPackets.size(); i < len;) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java index 72fdbf1534b65284ac8020dcc15fe1512766d087..60ec969a805be277932057bc7685aeedd06ee4c1 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -30,7 +30,7 @@ public class PacketPlayOutMapChunk implements Packet { // Paper end // Paper start - private final java.util.List extraPackets = new java.util.ArrayList<>(); + private final java.util.List extraPackets = new net.yatopia.server.list.GlueList<>(); // Yatopia private static final int TE_LIMIT = Integer.getInteger("tuinity.excessive-te-limit", 750); // Tuinity - handle oversized chunk data packets more robustly private static final int TE_SPLIT_LIMIT = Math.max(4096 + 1, Integer.getInteger("tuinity.te-split-limit", 15_000)); // Tuinity - handle oversized chunk data packets more robustly private boolean mustSplit; // Tuinity - handle oversized chunk data packets more robustly @@ -55,7 +55,7 @@ public class PacketPlayOutMapChunk implements Packet { Iterator iterator; // Tuinity - move declaration up Entry entry; // Tuinity - move delcaration up // Paper end - this.g = Lists.newArrayList(); + this.g = new net.yatopia.server.list.GlueList<>(); // Yatopia iterator = chunk.getTileEntities().entrySet().iterator(); int totalTileEntities = 0; // Paper @@ -158,7 +158,7 @@ public class PacketPlayOutMapChunk implements Packet { packetdataserializer.readBytes(this.f); int j = packetdataserializer.i(); - this.g = Lists.newArrayList(); + this.g = new net.yatopia.server.list.GlueList<>(); // Yatopia for (int k = 0; k < j; ++k) { this.g.add(packetdataserializer.l());