3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

Fix more issues

Dieser Commit ist enthalten in:
Jake Potrebic 2022-06-07 20:59:40 -07:00
Ursprung 7bbeef26ba
Commit c5db5371bf
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
3 geänderte Dateien mit 13 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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<Packet<?>> {
@ -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<Packet<?>> {
@@ -198,19 +203,89 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
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<? 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);
}
@ -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<Packet<?>> {
@@ -301,9 +422,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
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<Packet<?>> {
@@ -421,7 +555,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
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<Packet<?>> {
@@ -429,7 +563,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} else if (this.getPacketListener() != null) {
this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic"));
}

Datei anzeigen

@ -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();
}