mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-12 04:17:41 +01:00
60 lines
3.7 KiB
Diff
60 lines
3.7 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
||
|
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<Packet<?>> {
|
||
|
if (extra == null || extra.isEmpty()) {
|
||
|
return null;
|
||
|
}
|
||
|
- java.util.List<Packet> ret = new java.util.ArrayList<>(1 + extra.size());
|
||
|
+ java.util.List<Packet> 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<Packet<?>> {
|
||
|
if (!hasExtraPackets) {
|
||
|
this.packetQueue.add(new NetworkManager.QueuedPacket(packet, genericfuturelistener));
|
||
|
} else {
|
||
|
- java.util.List<NetworkManager.QueuedPacket> packets = new java.util.ArrayList<>(1 + extraPackets.size());
|
||
|
+ java.util.List<NetworkManager.QueuedPacket> 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<PacketListenerPlayOut> {
|
||
|
// Paper end
|
||
|
|
||
|
// Paper start
|
||
|
- private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>();
|
||
|
+ private final java.util.List<Packet> 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<PacketListenerPlayOut> {
|
||
|
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<PacketListenerPlayOut> {
|
||
|
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());
|