Format patches

This commit is contained in:
Sotr
2020-04-16 02:17:13 +07:00
parent 4b9b6169c3
commit 9f21b23335
10 changed files with 61 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
From 2586ac1cc5a0b940aa0b46721383c28e615e0dab Mon Sep 17 00:00:00 2001
From c3da24e911229cfcf8530507d75c719ce463b3eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
<tsao-chi@the-lingo.org>
Date: Sun, 5 Apr 2020 14:59:10 +0800
@@ -106,7 +106,7 @@ index f1222fcb2b..522cfed4cb 100644
protected GameProfile a(GameProfile gameprofile) {
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 96a785af27..f2a31f5923 100644
index 96a785af27..fd1d5fe3bf 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -43,6 +43,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -145,7 +145,7 @@ index 96a785af27..f2a31f5923 100644
if (enumprotocol != enumprotocol1) {
this.setProtocol(enumprotocol);
}
@@ -223,30 +225,71 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -223,30 +225,92 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
@@ -179,14 +179,35 @@ index 96a785af27..f2a31f5923 100644
+ NetworkManager.LOGGER.debug("Disabled auto read");
+ this.channel.config().setAutoRead(false);
+ this.setProtocol(enumprotocol);
+ }
+
}
- return true; // Return true if all packets were dispatched
+ ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
+
+ channelfuture.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
+
+ }
+
+ public void sendPackets(Packet<?> packet, Packet<?> other) {
+ EnumProtocol enumprotocol = packet.protocol();
+
+ ++this.q;
+ if (protocol != enumprotocol) {
+ NetworkManager.LOGGER.debug("Disabled auto read");
+ this.channel.config().setAutoRead(false);
+ }
+
+ this.channel.eventLoop().execute(() -> {
+ if (enumprotocol != protocol) {
+ this.setProtocol(enumprotocol);
+ }
+
+ this.channel.write(packet).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
+ this.channel.write(other).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
+ this.channel.flush();
+ });
+ }
+
+ public void sendPackets(Packet<?> packet, Packet<?> ...packets) {
+ EnumProtocol enumprotocol = packet.protocol();
+
@@ -194,9 +215,8 @@ index 96a785af27..f2a31f5923 100644
+ if (protocol != enumprotocol) {
+ NetworkManager.LOGGER.debug("Disabled auto read");
+ this.channel.config().setAutoRead(false);
}
- return true; // Return true if all packets were dispatched
+ }
+
+ this.channel.eventLoop().execute(() -> {
+ if (enumprotocol != protocol) {
+ this.setProtocol(enumprotocol);
@@ -206,6 +226,7 @@ index 96a785af27..f2a31f5923 100644
+ for (Packet<?> pkt : packets) {
+ this.channel.write(pkt).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
+ }
+
+ this.channel.flush();
+ });
+ }
@@ -238,7 +259,7 @@ index 96a785af27..f2a31f5923 100644
}
// Paper end
@@ -260,9 +303,9 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -260,9 +324,9 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
((PlayerConnection) this.packetListener).tick();
}
@@ -408,29 +429,33 @@ index 6dfbbc67dd..b23612817b 100644
@Override
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 6d6fbf2f50..4b549ccc41 100644
index 6d6fbf2f50..fa23e838ee 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -159,13 +159,15 @@ public abstract class PlayerList {
@@ -159,6 +159,8 @@ public abstract class PlayerList {
// Spigot - view distance
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), worldserver.spigotConfig.viewDistance, flag1, !flag));
entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
- playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
- playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
- playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
- playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
- playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
- playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
- playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
+ // Akarin Start
+ playerconnection.networkManager.sendPackets(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())),
+ // Akarin start - send multiple packets at once
+ /*
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
@@ -166,6 +168,17 @@ public abstract class PlayerList {
playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
+ */
+ playerconnection.networkManager.sendPackets(
+ new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())),
+ new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()),
+ new PacketPlayOutAbilities(entityplayer.abilities),
+ new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex),
+ new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()),
+ new PacketPlayOutTags(this.server.getTagRegistry()),
+ new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
+ // Akarin End
+ new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))
+ );
+ // Akarin end
this.d(entityplayer);
entityplayer.getStatisticManager().c();
entityplayer.B().a(entityplayer);

View File

@@ -1,4 +1,4 @@
From 68179ee6442dc582e64a3501badb23979d2a04b4 Mon Sep 17 00:00:00 2001
From e56c754100a66019abddd4b67521788e934ba89e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
<tsao-chi@the-lingo.org>
Date: Fri, 10 Apr 2020 15:47:15 +0800

View File

@@ -1,4 +1,4 @@
From e938a20dc137376d5f46fa6f1d70e556f1564cf8 Mon Sep 17 00:00:00 2001
From 310f33996722b048faa9bf70c4beaca783de989b Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 02:39:12 +0700
Subject: [PATCH] Tuinity Use ArrayDeque for pendingChunkUpdates in

View File

@@ -1,4 +1,4 @@
From 66108ad190cd38d84f63acf6a0fcf9274328cea8 Mon Sep 17 00:00:00 2001
From 448d83678ae21c978b2d7cd0294e8f412c317170 Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 02:44:07 +0700
Subject: [PATCH] Tuinity Optimise ArraySetSorted#removeIf

View File

@@ -1,4 +1,4 @@
From 15199cd32e2b5652cb7327a0023ffeedd691bcf4 Mon Sep 17 00:00:00 2001
From 58097b8b6c20d860e27b7a159fceb52de55462aa Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 02:49:56 +0700
Subject: [PATCH] Don't run entity collision code if not needed

View File

@@ -1,4 +1,4 @@
From b18cd3ce6068d169e62857776818a959edba0b7b Mon Sep 17 00:00:00 2001
From ae21af5043b9d3664b1ad091d40268c007a963da Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 03:51:50 +0700
Subject: [PATCH] Optimize door interact with pathfinding

View File

@@ -1,4 +1,4 @@
From 6476031ecb6212b4642a7676bb229a1c8f0bbc89 Mon Sep 17 00:00:00 2001
From 7e98197e956e3201e2505815a653cbd77fa844b8 Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 04:16:44 +0700
Subject: [PATCH] Remove stream for ender teleport

View File

@@ -1,4 +1,4 @@
From 6a4f18dea28f631dfacb16e988d6ada5ba270ad1 Mon Sep 17 00:00:00 2001
From 086e6eb2ed02d55f55aa49404fe1b58ef92ec0d7 Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 04:28:25 +0700
Subject: [PATCH] Cache hashcode for BlockPosition

View File

@@ -1,4 +1,4 @@
From 92c476dd12cb5965f1c793f37b1181460ac3dfcd Mon Sep 17 00:00:00 2001
From 973aed2e4aaa03aa708a697a9d0339f01f5f0e98 Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 17:49:07 +0700
Subject: [PATCH] Remove stream and simplify operation in pathfinder

View File

@@ -1,4 +1,4 @@
From 8f14fe9582edf5a744a0b52089800dc4f645b275 Mon Sep 17 00:00:00 2001
From 0793ce59f94297b12c49511ebe65c6f7914ea681 Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Wed, 15 Apr 2020 22:45:48 +0700
Subject: [PATCH] Remove a few more streams