mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-21 11:46:49 +01:00
Handle 1.20.5 -> 1.20.3 packet error handling changes
This commit is contained in:
parent
96f90c1f32
commit
e17698902a
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.DisconnectionInfo;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.class)
|
||||
public abstract class MixinClientCommonNetworkHandler {
|
||||
|
||||
@Inject(method = "savePacketErrorReport", at = @At("HEAD"), cancellable = true)
|
||||
private void dontCreatePacketErrorCrashReports(CallbackInfoReturnable<Optional<Path>> cir) {
|
||||
if (DebugSettings.global().dontCreatePacketErrorCrashReports.isEnabled()) {
|
||||
cir.setReturnValue(Optional.empty());
|
||||
}
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "onPacketException", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;disconnect(Lnet/minecraft/network/DisconnectionInfo;)V"))
|
||||
private boolean dontDisconnectOnPacketException(ClientConnection instance, DisconnectionInfo disconnectionInfo) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20_3);
|
||||
}
|
||||
|
||||
}
|
@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.protocol.version.VersionType;
|
||||
import com.viaversion.viaversion.connection.UserConnectionImpl;
|
||||
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.Protocol1_20_3To1_20_5;
|
||||
import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.ViaFabricPlusProtocol;
|
||||
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
|
||||
@ -342,7 +341,6 @@ public class ProtocolTranslator {
|
||||
ViaAprilFoolsPlatformImpl::new,
|
||||
ViaBedrockPlatformImpl::new
|
||||
);
|
||||
Protocol1_20_3To1_20_5.strictErrorHandling = false;
|
||||
ProtocolVersion.register(AUTO_DETECT_PROTOCOL);
|
||||
ViaFabricPlusProtocol.INSTANCE.initialize();
|
||||
});
|
||||
|
@ -35,6 +35,9 @@ public class DebugSettings extends SettingGroup {
|
||||
public final BooleanSetting printNetworkingErrorsToLogs = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.print_networking_errors_to_logs"), true);
|
||||
public final BooleanSetting ignoreFabricSyncErrors = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.ignore_fabric_sync_errors"), false);
|
||||
|
||||
// 1.20.5 -> 1.20.4
|
||||
public final VersionedBooleanSetting dontCreatePacketErrorCrashReports = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.dont_create_packet_error_crash_reports"), VersionRange.andOlder(ProtocolVersion.v1_20_3));
|
||||
|
||||
// 1.19 -> 1.18.2
|
||||
public final VersionedBooleanSetting disableSequencing = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.disable_sequencing"), VersionRange.andOlder(ProtocolVersion.v1_18_2));
|
||||
|
||||
|
@ -63,6 +63,7 @@
|
||||
"debug_settings.viafabricplus.prevent_entity_cramming": "Prevent entity cramming",
|
||||
"debug_settings.viafabricplus.always_tick_client_player": "Always tick client player",
|
||||
"debug_settings.viafabricplus.print_networking_errors_to_logs": "Print networking errors to logs",
|
||||
"debug_settings.viafabricplus.dont_create_packet_error_crash_reports": "Don't create packet error crash reports",
|
||||
"debug_settings.viafabricplus.ignore_fabric_sync_errors": "Ignore Fabric sync errors",
|
||||
"debug_settings.viafabricplus.legacy_tab_completions": "Legacy tab completions",
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
"fixes.minecraft.MixinCamera",
|
||||
"fixes.minecraft.MixinChatInputSuggestor",
|
||||
"fixes.minecraft.MixinClientCommandSource",
|
||||
"fixes.minecraft.MixinClientCommonNetworkHandler",
|
||||
"fixes.minecraft.MixinClientWorld",
|
||||
"fixes.minecraft.MixinFlowableFluid",
|
||||
"fixes.minecraft.MixinFontStorage",
|
||||
|
Loading…
Reference in New Issue
Block a user