-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ae1def
commit bd3a222
Showing
174 changed files
with
6,391 additions
and
5,253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
patches/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 66 additions & 14 deletions
80
patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,81 @@ | ||
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java | ||
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java | ||
@@ -45,11 +_,15 @@ | ||
@@ -26,6 +_,9 @@ | ||
private final GameProfile localGameProfile; | ||
private RegistryAccess.Frozen receivedRegistries; | ||
private FeatureFlagSet enabledFeatures; | ||
+ private boolean isModdedConnection = false; | ||
+ private boolean isVanillaConnection = true; | ||
+ private java.util.Map<net.minecraft.resources.ResourceLocation, net.minecraft.network.chat.Component> failureReasons = new java.util.HashMap<>(); | ||
|
||
public ClientConfigurationPacketListenerImpl(Minecraft p_295262_, Connection p_296339_, CommonListenerCookie p_294706_) { | ||
super(p_295262_, p_296339_, p_294706_); | ||
@@ -45,7 +_,30 @@ | ||
} | ||
|
||
@Override | ||
- protected void handleCustomPayload(CustomPacketPayload p_295411_) { | ||
- this.handleUnknownCustomPayload(p_295411_); | ||
+ protected void handleCustomPayload(net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket p_295727_, CustomPacketPayload p_295411_) { | ||
+ this.handleUnknownCustomPayload(p_295727_, p_295411_); | ||
} | ||
|
||
- private void handleUnknownCustomPayload(CustomPacketPayload p_296412_) { | ||
+ private void handleUnknownCustomPayload(net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket p_295727_, CustomPacketPayload p_296412_) { | ||
+ if (p_296412_ instanceof net.neoforged.neoforge.network.custom.payload.SimplePayload simplePayload && net.neoforged.neoforge.network.NetworkHooks.onCustomPayload(p_295727_, simplePayload, connection)) { | ||
+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.ModdedNetworkQueryPayload) { | ||
+ this.isModdedConnection = true; | ||
+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onNetworkQuery(this); | ||
+ return; | ||
+ } | ||
+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.ModdedNetworkPayload moddedNetworkPayload) { | ||
+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedNetworkConnectionEstablished(this, moddedNetworkPayload.configuration(), moddedNetworkPayload.play()); | ||
+ return; | ||
+ } | ||
+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.ModdedNetworkSetupFailedPayload setupFailedPayload) { | ||
+ failureReasons = setupFailedPayload.failureReasons(); | ||
+ } | ||
+ if (!this.isModdedConnection && p_295411_ instanceof net.minecraft.network.protocol.common.custom.BrandPayload) { | ||
+ this.isVanillaConnection = true; | ||
+ if (!net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaNetworkConnectionEstablished(this)) { | ||
+ return; | ||
+ } | ||
+ } | ||
+ if (this.isModdedConnection) { | ||
+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedPacketAtClient(this, p_295727_); | ||
+ return; | ||
+ } | ||
+ | ||
LOGGER.warn("Unknown custom packet payload: {}", p_296412_.id()); | ||
this.handleUnknownCustomPayload(p_295411_); | ||
} | ||
|
||
@@ -93,6 +_,7 @@ | ||
); | ||
this.connection.resumeInboundAfterProtocolChange(); | ||
this.connection.send(new ServerboundFinishConfigurationPacket()); | ||
+ net.neoforged.neoforge.network.NetworkHooks.handleClientLoginSuccess(this.connection); | ||
@@ -69,6 +_,11 @@ | ||
@Override | ||
public void handleEnabledFeatures(ClientboundUpdateEnabledFeaturesPacket p_294410_) { | ||
this.enabledFeatures = FeatureFlags.REGISTRY.fromNames(p_294410_.features()); | ||
+ //Fallback detection layer for vanilla servers | ||
+ if (!this.isModdedConnection) { | ||
+ this.isVanillaConnection = true; | ||
+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaNetworkConnectionEstablished(this); | ||
+ } | ||
} | ||
|
||
@Override | ||
@@ -87,7 +_,8 @@ | ||
this.enabledFeatures, | ||
this.serverBrand, | ||
this.serverData, | ||
- this.postDisconnectScreen | ||
+ this.postDisconnectScreen, | ||
+ this.isModdedConnection | ||
) | ||
) | ||
); | ||
@@ -104,5 +_,14 @@ | ||
public void onDisconnect(Component p_314649_) { | ||
super.onDisconnect(p_314649_); | ||
this.minecraft.clearDownloadedResourcePacks(); | ||
+ } | ||
+ | ||
+ @Override | ||
+ protected net.minecraft.client.gui.screens.Screen createDisconnectScreen(net.minecraft.network.chat.Component p_296470_) { | ||
+ final net.minecraft.client.gui.screens.Screen superScreen = super.createDisconnectScreen(p_296470_); | ||
+ if (failureReasons.isEmpty()) | ||
+ return superScreen; | ||
+ | ||
+ return new net.neoforged.neoforge.client.gui.ModMismatchDisconnectedScreen(superScreen, p_296470_, failureReasons); | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
patches/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- a/net/minecraft/client/multiplayer/CommonListenerCookie.java | ||
+++ b/net/minecraft/client/multiplayer/CommonListenerCookie.java | ||
@@ -17,6 +_,15 @@ | ||
FeatureFlagSet enabledFeatures, | ||
@Nullable String serverBrand, | ||
@Nullable ServerData serverData, | ||
- @Nullable Screen postDisconnectScreen | ||
+ @Nullable Screen postDisconnectScreen, | ||
+ boolean isModdedConnection | ||
) { | ||
+ | ||
+ /** | ||
+ * @deprecated Use {@link #CommonListenerCookie(GameProfile, WorldSessionTelemetryManager, RegistryAccess.Frozen, FeatureFlagSet, String, ServerData, Screen, boolean)} instead, to indicate whether the connection is modded. | ||
+ */ | ||
+ @Deprecated | ||
+ public CommonListenerCookie(GameProfile localGameProfile, WorldSessionTelemetryManager telemetryManager, RegistryAccess.Frozen receivedRegistries, FeatureFlagSet enabledFeatures, @Nullable String serverBrand, @Nullable ServerData serverData, @Nullable Screen postDisconnectScreen) { | ||
+ this(localGameProfile, telemetryManager, receivedRegistries, enabledFeatures, serverBrand, serverData, postDisconnectScreen, false); | ||
+ } | ||
} |
10 changes: 0 additions & 10 deletions
10
patches/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.