Fix more issues

This commit is contained in:
Jake Potrebic 2022-06-07 20:59:40 -07:00
parent 7bbeef26ba
commit c5db5371bf
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
3 changed files with 13 additions and 11 deletions

View File

@ -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 blockY
public net.minecraft.world.level.levelgen.SurfaceRules$Context blockZ 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 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$LazyYCondition
public net.minecraft.world.level.levelgen.SurfaceRules$LazyCondition public net.minecraft.world.level.levelgen.SurfaceRules$LazyCondition
public net.minecraft.world.level.levelgen.SurfaceRules$VerticalGradientConditionSource public net.minecraft.world.level.levelgen.SurfaceRules$VerticalGradientConditionSource

View File

@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf 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 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 --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/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<Packet<?>> { @@ -97,6 +97,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -50,7 +50,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50
this.channel.attr(Connection.ATTRIBUTE_PROTOCOL).set(state); this.channel.attr(Connection.ATTRIBUTE_PROTOCOL).set(state);
this.channel.config().setAutoRead(true); this.channel.config().setAutoRead(true);
Connection.LOGGER.debug("Enabled auto read"); Connection.LOGGER.debug("Enabled auto read");
@@ -198,19 +203,87 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -198,19 +203,89 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
Validate.notNull(listener, "packetListener", new Object[0]); Validate.notNull(listener, "packetListener", new Object[0]);
this.packetListener = listener; this.packetListener = listener;
} }
@ -86,7 +86,9 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50
+ private static boolean canSendImmediate(Connection networkManager, Packet<?> packet) { + private static boolean canSendImmediate(Connection networkManager, Packet<?> packet) {
+ return networkManager.isPending || networkManager.protocol != ConnectionProtocol.PLAY || + return networkManager.isPending || networkManager.protocol != ConnectionProtocol.PLAY ||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundKeepAlivePacket || + 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.ClientboundCommandSuggestionsPacket ||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket || + packet instanceof net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket ||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket || + packet instanceof net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket ||
@ -142,7 +144,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50
} }
private void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) { private void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) {
@@ -238,33 +311,79 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -238,33 +313,79 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.setProtocol(packetState); this.setProtocol(packetState);
} }
@ -170,7 +172,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50
+ // Paper start + // Paper start
+ } catch (Exception e) { + } catch (Exception e) {
+ LOGGER.error("NetworkException: " + player, 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); + packet.onPacketDispatchFinish(player, null);
+ } + }
+ // Paper end + // Paper end
@ -231,7 +233,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50
public void tick() { public void tick() {
this.flushQueue(); this.flushQueue();
@@ -301,9 +420,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -301,9 +422,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
return this.address; return this.address;
} }
@ -254,7 +256,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50
// Spigot End // Spigot End
if (this.channel.isOpen()) { if (this.channel.isOpen()) {
this.channel.close(); // We can't wait as this may be called from an event loop. 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<Packet<?>> { @@ -421,7 +555,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public void handleDisconnection() { public void handleDisconnection() {
if (this.channel != null && !this.channel.isOpen()) { if (this.channel != null && !this.channel.isOpen()) {
if (this.disconnectionHandled) { if (this.disconnectionHandled) {
@ -263,7 +265,7 @@ index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f50
} else { } else {
this.disconnectionHandled = true; this.disconnectionHandled = true;
if (this.getDisconnectedReason() != null) { if (this.getDisconnectedReason() != null) {
@@ -429,7 +561,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -429,7 +563,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} else if (this.getPacketListener() != null) { } else if (this.getPacketListener() != null) {
this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic")); this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic"));
} }

View File

@ -115,14 +115,14 @@ index 06e1774dfbb667aca69bc30c9675ed472cb5728c..e380a62e44d93c434128a656d509c889
public static SurfaceRules.RuleSource end() { 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 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 --- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -75,6 +75,7 @@ public class Bootstrap { @@ -75,6 +75,7 @@ public class Bootstrap {
EntitySelectorOptions.bootStrap(); EntitySelectorOptions.bootStrap();
DispenseItemBehavior.bootStrap(); DispenseItemBehavior.bootStrap();
CauldronInteraction.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(); Registry.freezeBuiltins();
Bootstrap.wrapStreams(); Bootstrap.wrapStreams();
} }