mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-24 22:01:24 +01:00
Re-add old WON_GAME state handling in <= 1.20.5
This commit is contained in:
parent
0ed772f477
commit
9ff009237d
@ -41,7 +41,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
* - Particle handling has slightly changed
|
||||
*
|
||||
* TODO | Port 1.21
|
||||
* - Win Game State 0 missing now
|
||||
* - LocalPlayer#aiStep nether portal logic and sneaking attribute
|
||||
* - Camera logic got changed again
|
||||
* - ExtraCodecs#QUATERNIONF_COMPONENTS
|
||||
|
@ -31,6 +31,7 @@ import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.BookScreen;
|
||||
import net.minecraft.client.network.*;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
@ -41,6 +42,7 @@ import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.packet.c2s.play.ClientStatusC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.play.*;
|
||||
import net.minecraft.recipe.RecipeEntry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
@ -90,6 +92,20 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21);
|
||||
}
|
||||
|
||||
@Redirect(method = "onGameStateChange", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V", ordinal = 0))
|
||||
public void handleWinGameState0(MinecraftClient instance, Screen screen, @Local int i) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
if (i == 0) {
|
||||
this.client.player.networkHandler.sendPacket(new ClientStatusC2SPacket(ClientStatusC2SPacket.Mode.PERFORM_RESPAWN));
|
||||
this.client.setScreen(new DownloadingTerrainScreen(() -> false, DownloadingTerrainScreen.WorldEntryReason.END_PORTAL));
|
||||
} else if (i == 1) {
|
||||
instance.setScreen(screen);
|
||||
}
|
||||
} else {
|
||||
instance.setScreen(screen);
|
||||
}
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "onEnterReconfiguration", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendAcknowledgment()V"))
|
||||
private boolean dontSendChatAck(ClientPlayNetworkHandler instance) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_5);
|
||||
|
Loading…
Reference in New Issue
Block a user