mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-08 19:38:57 +01:00
Cleanup mixins
This commit is contained in:
parent
088290e352
commit
a199f553af
@ -131,4 +131,5 @@ public class ViaFabricPlusProtocol extends AbstractSimpleProtocol {
|
||||
void read(PacketWrapper wrapper);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
|
||||
// Minecraft 1.6.4 supports split encryption/decryption which means the server can only enable one side of the encryption
|
||||
// So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol
|
||||
// tells us to do, therefore we need to store the cipher instance.
|
||||
// tells us to do, therefore, we need to store the cipher instance.
|
||||
this.viaFabricPlus$decryptionCipher = decryptionCipher;
|
||||
|
||||
// Enabling the encryption side
|
||||
|
@ -26,7 +26,7 @@ import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(GameOptions.class)
|
||||
public class MixinGameOptions {
|
||||
public abstract class MixinGameOptions {
|
||||
|
||||
@Shadow
|
||||
public boolean useNativeTransport;
|
||||
|
@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
public abstract class MixinClientConnection {
|
||||
|
||||
@Inject(method = "exceptionCaught", at = @At("HEAD"))
|
||||
private void printNetworkingErrors(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) {
|
||||
|
@ -71,6 +71,16 @@ public abstract class MixinClientCommonNetworkHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Inject(method = "onResourcePackSend", at = @At("HEAD"), cancellable = true)
|
||||
private void validateUrlInNetworkThread(ResourcePackSendS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
|
||||
if (getParsedResourcePackUrl(packet.url()) == null) {
|
||||
this.connection.send(new ResourcePackStatusC2SPacket(packet.id(), ResourcePackStatusC2SPacket.Status.INVALID_URL));
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "onKeepAlive", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientCommonNetworkHandler;send(Lnet/minecraft/network/packet/Packet;Ljava/util/function/BooleanSupplier;Ljava/time/Duration;)V"))
|
||||
private void forceSendKeepAlive(ClientCommonNetworkHandler instance, Packet<? extends ServerPacketListener> packet, BooleanSupplier sendCondition, Duration expiry) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
@ -108,14 +118,4 @@ public abstract class MixinClientCommonNetworkHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onResourcePackSend", at = @At("HEAD"), cancellable = true)
|
||||
private void validateUrlInNetworkThread(ResourcePackSendS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
|
||||
if (getParsedResourcePackUrl(packet.url()) == null) {
|
||||
this.connection.send(new ResourcePackStatusC2SPacket(packet.id(), ResourcePackStatusC2SPacket.Status.INVALID_URL));
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user