Make it compie

This commit is contained in:
Nassim Jahnke 2022-07-28 00:20:14 +02:00
parent cb6f029de9
commit d41ecbe5c3
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
6 changed files with 39 additions and 27 deletions

View File

@ -88,7 +88,7 @@ index 0000000000000000000000000000000000000000..980e2b4dc308adf9a6cb2596b28eaeee
+ }
+}
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 7c3c76b7ef169e0c0832e26212775111deb505c0..c501e41ed7dd41a51cb87d4cf7ac62d694601156 100644
index 7c3c76b7ef169e0c0832e26212775111deb505c0..63abdc84bbd8d3ef78e18ffe792f2f1e5035e2ff 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -70,6 +70,7 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
@ -129,7 +129,7 @@ index 7c3c76b7ef169e0c0832e26212775111deb505c0..c501e41ed7dd41a51cb87d4cf7ac62d6
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
@@ -437,6 +454,58 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
@@ -437,6 +454,59 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
// Spigot end
public void handleCustomQueryPacket(ServerboundCustomQueryPacket packet) {
@ -164,9 +164,10 @@ index 7c3c76b7ef169e0c0832e26212775111deb505c0..c501e41ed7dd41a51cb87d4cf7ac62d6
+ //noinspection NonStrictComparisonCanBeEquality
+ if (version >= com.destroystokyo.paper.proxy.VelocityProxy.MODERN_FORWARDING_WITH_KEY) {
+ final ProfilePublicKey.Data forwardedKey = com.destroystokyo.paper.proxy.VelocityProxy.readForwardedKey(buf);
+ if (this.playerProfilePublicKey == null) {
+ if (this.profilePublicKeyData == null) {
+ try {
+ this.playerProfilePublicKey = ProfilePublicKey.createValidated(this.server.getServiceSignatureValidator(), forwardedKey);
+ ProfilePublicKey.createValidated(this.server.getServiceSignatureValidator(), this.gameProfile.getId(), forwardedKey);
+ this.profilePublicKeyData = forwardedKey;
+ } catch (CryptException e) {
+ this.disconnect("Unable to validate forwarded player key");
+ }

View File

@ -74,7 +74,7 @@ index e1e35bd6fb827149b23da4d19876a9a6989dde7e..4408c30532119277abb1027cd5a08e4c
this.server.getProfiler().push("keepAlive");
// Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index c501e41ed7dd41a51cb87d4cf7ac62d694601156..31a506e78264f354394afc37fb7ebb3d0c7d6ebd 100644
index 63abdc84bbd8d3ef78e18ffe792f2f1e5035e2ff..11a7b79b25f3ad83687f6f9076231e227ebea165 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -95,7 +95,7 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
@ -96,7 +96,7 @@ index c501e41ed7dd41a51cb87d4cf7ac62d694601156..31a506e78264f354394afc37fb7ebb3d
try {
ServerPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 1f32ba033eedcb69b02c29da8594be9edf958f43..4e662c672a554528dca7cdd31ae39957288943e3 100644
index 1f32ba033eedcb69b02c29da8594be9edf958f43..4173c9c364be3a266a8ba43b384ee230e6f98f62 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -139,6 +139,7 @@ public abstract class PlayerList {
@ -182,10 +182,10 @@ index 1f32ba033eedcb69b02c29da8594be9edf958f43..4e662c672a554528dca7cdd31ae39957
+
+ void disconnectPendingPlayer(ServerPlayer entityplayer) {
+ Component msg = Component.translatable("multiplayer.disconnect.duplicate_login");
+ entityplayer.networkManager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(msg), (future) -> {
+ entityplayer.networkManager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(msg), net.minecraft.network.PacketSendListener.thenRun(() -> {
+ entityplayer.networkManager.disconnect(msg);
+ entityplayer.networkManager = null;
+ });
+ }));
+ }
+
+ private void postChunkLoadJoin(ServerPlayer player, ServerLevel worldserver1, Connection networkmanager, ServerGamePacketListenerImpl playerconnection, CompoundTag nbttagcompound, String s1, String s) {

View File

@ -6,25 +6,38 @@ Subject: [PATCH] Remove some streams from structures
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
index 24f58441ae7b43a62d74aa55e9808c1c65f466e4..8ec886a10fc901a964f626a350b39c3fda0e59d9 100644
index 24f58441ae7b43a62d74aa55e9808c1c65f466e4..99e329d374b60ebf77f93551f6bf83b9bca1e4b8 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
@@ -36,10 +36,11 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
@@ -36,9 +36,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
int j = pos.getMinBlockZ();
ObjectList<Beardifier.Rigid> objectList = new ObjectArrayList<>(10);
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<>(32);
- world.startsForStructure(pos, (structure) -> {
+ // Paper start - replace for each
+ for (net.minecraft.world.level.levelgen.structure.StructureStart structureStart : structureManager.startsForStructure(pos, (structure) -> {
+ for (net.minecraft.world.level.levelgen.structure.StructureStart start : world.startsForStructure(pos, (structure) -> {
return structure.terrainAdaptation() != TerrainAdjustment.NONE;
- }).forEach((start) -> {
- TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation();
+ })) { // Paper end
+ TerrainAdjustment terrainAdjustment = structureStart.getStructure().terrainAdaptation();
TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation();
for(StructurePiece structurePiece : start.getPieces()) {
if (structurePiece.isCloseToChunk(pos, 12)) {
@@ -63,7 +64,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
@@ -51,9 +52,11 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
}
for(JigsawJunction jigsawJunction : poolElementStructurePiece.getJunctions()) {
- int i = jigsawJunction.getSourceX();
- int j = jigsawJunction.getSourceZ();
- if (i > i - 12 && j > j - 12 && i < i + 15 + 12 && j < j + 15 + 12) {
+ // Paper start - decompile fix
+ int i2 = jigsawJunction.getSourceX();
+ int j2 = jigsawJunction.getSourceZ();
+ if (i2 > i - 12 && j2 > j - 12 && i2 < i + 15 + 12 && j2 < j + 15 + 12) {
+ // Paper end
objectList2.add(jigsawJunction);
}
}
@@ -63,7 +66,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
}
}

View File

@ -42,10 +42,10 @@ index 99b581052f937b0f2d6b5d73de699008c1d51774..ed54479b14dcfc736ac90749106557f0
for(int i = 0; i < bs.length; ++i) {
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 049e64c355d5f064009b1107ad15d28c44f999dd..a34f22cadc09e53ea4de787b04d050b99dddbcac 100644
index 049e64c355d5f064009b1107ad15d28c44f999dd..acfa1907bfc9c29d261cfccc00d65bad9ad1a002 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -30,11 +30,17 @@ public class PacketUtils {
@@ -30,11 +30,15 @@ public class PacketUtils {
try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
} catch (Exception exception) {
@ -60,9 +60,7 @@ index 049e64c355d5f064009b1107ad15d28c44f999dd..a34f22cadc09e53ea4de787b04d050b9
-
- PacketUtils.LOGGER.error("Failed to handle packet {}, suppressing error", packet, exception);
+ net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
+ networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> {
+ networkmanager.disconnect(error);
+ });
+ networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
+ networkmanager.setReadOnly();
}
} else {

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Detail more information in watchdog dumps
- Dump player name, player uuid, position, and world for packet handling
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 2195024a7b2626f4e6844db56071130226cf1364..92b36499c7b655b1b7d866fe116486962aef1803 100644
index dc6b467f51b6e17aa46ccce75aa40788afcdf010..28471311a992f5183c39b1a692e0251eb1fee1df 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -475,9 +475,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -27,7 +27,7 @@ index 2195024a7b2626f4e6844db56071130226cf1364..92b36499c7b655b1b7d866fe11648696
if (!this.isConnected() && !this.disconnectionHandled) {
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index a34f22cadc09e53ea4de787b04d050b99dddbcac..c8012de68b997d6270ba4a5d79bc93c09ff4354f 100644
index acfa1907bfc9c29d261cfccc00d65bad9ad1a002..d6f3869f5725c7f081efb7f486f74dbb99d4d005 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -15,6 +15,24 @@ public class PacketUtils {
@ -64,7 +64,7 @@ index a34f22cadc09e53ea4de787b04d050b99dddbcac..c8012de68b997d6270ba4a5d79bc93c0
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.getConnection().isConnected()) {
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
@@ -45,6 +65,12 @@ public class PacketUtils {
@@ -43,6 +63,12 @@ public class PacketUtils {
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add config option for logging player ip addresses
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index c8012de68b997d6270ba4a5d79bc93c09ff4354f..1429f938c36d5a3a33e71837f440b2303d60cfe7 100644
index d6f3869f5725c7f081efb7f486f74dbb99d4d005..8bc0cb9ad5bb4e76d962ff54305e2c08e279a17b 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -51,10 +51,11 @@ public class PacketUtils {
@ -21,7 +21,7 @@ index c8012de68b997d6270ba4a5d79bc93c09ff4354f..1429f938c36d5a3a33e71837f440b230
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper
}
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> {
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
index 37cd7b44559e5705b31296df87c94d2ab200138d..37e52ea9ab694b466358981bc2a3c99f28a70c7d 100644
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
@ -49,7 +49,7 @@ index 2985271132c9ae822dcb0d7a7e6f0c268d1736cc..cfdbcd024de6ad0f9d4e83b2f912b36e
networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), PacketSendListener.thenRun(() -> {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 547abc18f1e03945977bd38947d9db5e201045c4..303981c9b873eee07052fbe607690d12074cd1d1 100644
index c246fbd3c155d74684c3a105818abef833f1ed96..c1cb1406bf00843568e94c5d72cf60b3e5455720 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -241,7 +241,10 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
@ -65,7 +65,7 @@ index 547abc18f1e03945977bd38947d9db5e201045c4..303981c9b873eee07052fbe607690d12
@Nullable
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index dda357b4f52030435c012f10b11f1ccb3f6688be..1548df4057b34fe6bad2c51fb5a77ce118b36566 100644
index 76fa5e31701bc0e504d8e7b6ebfa737f3a10dc3b..75c64d23eb15368f8a40ebf9026d54604d450f91 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -241,7 +241,7 @@ public abstract class PlayerList {