From c5db5371bf3f4d519380bec599342517fe517e1e Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 7 Jun 2022 20:59:40 -0700 Subject: [PATCH] Fix more issues --- build-data/paper.at | 2 +- ...k-Manager-and-add-advanced-packet-sup.patch | 18 ++++++++++-------- .../0336-Flat-bedrock-generator-settings.patch | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/build-data/paper.at b/build-data/paper.at index 4671b6eb7..d0c7a42e1 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -289,7 +289,7 @@ public net.minecraft.world.level.levelgen.SurfaceRules$Context blockX public net.minecraft.world.level.levelgen.SurfaceRules$Context blockY public net.minecraft.world.level.levelgen.SurfaceRules$Context blockZ public net.minecraft.world.level.levelgen.SurfaceRules$Context context -public net.minecraft.world.level.levelgen.SurfaceRules$Context system +public net.minecraft.world.level.levelgen.SurfaceRules$Context randomState public net.minecraft.world.level.levelgen.SurfaceRules$LazyYCondition public net.minecraft.world.level.levelgen.SurfaceRules$LazyCondition public net.minecraft.world.level.levelgen.SurfaceRules$VerticalGradientConditionSource diff --git a/patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 33cf971f1..ae6bea162 100644 --- a/patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -28,7 +28,7 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f508e3dd125 100644 +index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..97166c362a5468e3f7e2fcfd5e318dc519bfbf6c 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -97,6 +97,10 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -50,7 +50,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50 this.channel.attr(Connection.ATTRIBUTE_PROTOCOL).set(state); this.channel.config().setAutoRead(true); Connection.LOGGER.debug("Enabled auto read"); -@@ -198,19 +203,87 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -198,19 +203,89 @@ public class Connection extends SimpleChannelInboundHandler> { Validate.notNull(listener, "packetListener", new Object[0]); this.packetListener = listener; } @@ -86,7 +86,9 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50 + private static boolean canSendImmediate(Connection networkManager, Packet packet) { + return networkManager.isPending || networkManager.protocol != ConnectionProtocol.PLAY || + packet instanceof net.minecraft.network.protocol.game.ClientboundKeepAlivePacket || -+ packet instanceof net.minecraft.network.protocol.game.ClientboundChatPacket || ++ packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket || ++ packet instanceof net.minecraft.network.protocol.game.ClientboundSystemChatPacket || ++ packet instanceof net.minecraft.network.protocol.game.ClientboundChatPreviewPacket || + packet instanceof net.minecraft.network.protocol.game.ClientboundCommandSuggestionsPacket || + packet instanceof net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket || + packet instanceof net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket || @@ -142,7 +144,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50 } private void sendPacket(Packet packet, @Nullable GenericFutureListener> callback) { -@@ -238,33 +311,79 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -238,33 +313,79 @@ public class Connection extends SimpleChannelInboundHandler> { this.setProtocol(packetState); } @@ -170,7 +172,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50 + // Paper start + } catch (Exception e) { + LOGGER.error("NetworkException: " + player, e); -+ disconnect(new net.minecraft.network.chat.TranslatableComponent("disconnect.genericReason", "Internal Exception: " + e.getMessage())); ++ disconnect(Component.translatable("disconnect.genericReason", "Internal Exception: " + e.getMessage())); + packet.onPacketDispatchFinish(player, null); + } + // Paper end @@ -231,7 +233,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50 public void tick() { this.flushQueue(); -@@ -301,9 +420,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -301,9 +422,22 @@ public class Connection extends SimpleChannelInboundHandler> { return this.address; } @@ -254,7 +256,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50 // Spigot End if (this.channel.isOpen()) { this.channel.close(); // We can't wait as this may be called from an event loop. -@@ -421,7 +553,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -421,7 +555,7 @@ public class Connection extends SimpleChannelInboundHandler> { public void handleDisconnection() { if (this.channel != null && !this.channel.isOpen()) { if (this.disconnectionHandled) { @@ -263,7 +265,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50 } else { this.disconnectionHandled = true; if (this.getDisconnectedReason() != null) { -@@ -429,7 +561,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -429,7 +563,7 @@ public class Connection extends SimpleChannelInboundHandler> { } else if (this.getPacketListener() != null) { this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic")); } diff --git a/patches/server/0336-Flat-bedrock-generator-settings.patch b/patches/server/0336-Flat-bedrock-generator-settings.patch index a12a4d90b..f7e50ecbc 100644 --- a/patches/server/0336-Flat-bedrock-generator-settings.patch +++ b/patches/server/0336-Flat-bedrock-generator-settings.patch @@ -115,14 +115,14 @@ index 06e1774dfbb667aca69bc30c9675ed472cb5728c..e380a62e44d93c434128a656d509c889 public static SurfaceRules.RuleSource end() { diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java -index 813bf8974d0c565f8f4ba255902276156288c0f1..5fc05273e22a6d15852822cbe7298c06e8a73476 100644 +index 813bf8974d0c565f8f4ba255902276156288c0f1..9525a4adddb5e3c00f1470fc2eeca16b43233428 100644 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java @@ -75,6 +75,7 @@ public class Bootstrap { EntitySelectorOptions.bootStrap(); DispenseItemBehavior.bootStrap(); CauldronInteraction.bootStrap(); -+ Registry.register(net.minecraft.core.Registry.CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC); // Paper - register custom flat bedrock thing. TODO is this the best place to do this? ++ Registry.register(net.minecraft.core.Registry.CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec()); // Paper - register custom flat bedrock thing. TODO is this the best place to do this? Registry.freezeBuiltins(); Bootstrap.wrapStreams(); }