mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-02-22 02:41:29 +01:00
fixed KeepAlive sender, updated README
This commit is contained in:
parent
a422825b0b
commit
26dbfe1d90
@ -7,7 +7,7 @@
|
||||
<a href="https://modrinth.com/mod/viafabricplus"><img src="https://img.shields.io/badge/dynamic/json?color=158000&label=downloads&prefix=+%20&query=downloads&url=https://api.modrinth.com/v2/project/rIC2XJV4&logo=modrinth"></a>
|
||||
<a href="https://curseforge.com/minecraft/mc-mods/viafabricplus"><img src="https://cf.way2muchnoise.eu/full_830604_downloads.svg"></a>
|
||||
|
||||
#### Clientside ViaVersion, ViaLegacy, ViaBedrock and ViaAprilFools implementation with clientside fixes for Fabric
|
||||
#### Fabric mod to connect to EVERY minecraft server version (Release, Alpha, Beta, Classic, AprilFools, Bedrock) with QoL fixes to the gameplay
|
||||
This project has nothing to do with the original ViaFabric and is therefore also not compact
|
||||
</div>
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPlayerPositionLookS2CPacket;
|
||||
import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
|
||||
@ -33,6 +34,9 @@ import net.minecraft.client.util.telemetry.WorldSession;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.listener.ServerPlayPacketListener;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.c2s.play.KeepAliveC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.play.*;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@ -44,8 +48,10 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@Mixin(ClientPlayNetworkHandler.class)
|
||||
@ -65,7 +71,9 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Shadow public abstract void onEntityVelocityUpdate(EntityVelocityUpdateS2CPacket packet);
|
||||
|
||||
@Shadow @Final private ClientConnection connection;
|
||||
@Shadow protected abstract void sendPacket(Packet<ServerPlayPacketListener> packet, BooleanSupplier sendCondition, Duration expirationTime);
|
||||
|
||||
@Shadow public abstract void sendPacket(Packet<?> packet);
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
public void fixPlayerListOrdering(MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) {
|
||||
@ -153,6 +161,15 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "onKeepAlive", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;Ljava/util/function/BooleanSupplier;Ljava/time/Duration;)V"))
|
||||
public void forceSendKeepAlive(ClientPlayNetworkHandler instance, Packet<ServerPlayPacketListener> packet, BooleanSupplier sendCondition, Duration expirationTime) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
sendPacket(packet);
|
||||
return;
|
||||
}
|
||||
sendPacket(packet, sendCondition, expirationTime);
|
||||
}
|
||||
|
||||
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;isSecureChatEnforced()Z"))
|
||||
public boolean removeSecureChatWarning(ServerMetadataS2CPacket instance) {
|
||||
return instance.isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.getValue();
|
||||
|
Loading…
Reference in New Issue
Block a user