Merge remote-tracking branch 'origin/main' into 1.20-recode

# Conflicts:
#	gradle.properties
#	src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java
This commit is contained in:
FlorianMichael 2023-05-23 17:10:54 +02:00
commit 14aa090c25
5 changed files with 16 additions and 10 deletions

View File

@ -19,7 +19,7 @@ ViaFabricPlus is intended to replace [multiconnect](https://github.com/Earthcomp
- Alpha (a1.0.15 - a1.2.6) - Alpha (a1.0.15 - a1.2.6)
- Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension)) - Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension))
- Snapshots (3D Shareware, 20w14infinite, Combat Test 8C) - Snapshots (3D Shareware, 20w14infinite, Combat Test 8C)
- Bedrock (1.19.70) - Bedrock (1.19.80)
# For users # For users
### Detailed instructions for use are available here [here](.github/USAGE.md) ### Detailed instructions for use are available here [here](.github/USAGE.md)
@ -29,6 +29,8 @@ ViaFabricPlus is intended to replace [multiconnect](https://github.com/Earthcomp
- ***[ViaFabric](https://github.com/ViaVersion/ViaFabric)*** - ***[ViaFabric](https://github.com/ViaVersion/ViaFabric)***
- ***[multiconnect](https://github.com/Earthcomputer/multiconnect)*** - ***[multiconnect](https://github.com/Earthcomputer/multiconnect)***
- ***[krypton](https://github.com/astei/krypton)*** - ***[krypton](https://github.com/astei/krypton)***
- ***[MemoryLeakFix](https://github.com/fxmorin/MemoryLeakFix)***
- ***[ReplayMod](https://www.replaymod.com/)***
## List of all clientside related fixes ## List of all clientside related fixes
<details> <details>
@ -61,6 +63,7 @@ Translations for other languages are always welcome, in **~/resources/assets/via
if you know a language well, feel free to make a PR and add translations for that language <br> if you know a language well, feel free to make a PR and add translations for that language <br>
### Dependencies ### Dependencies
For compiling only! **You do not need to install these!**
<details> <details>
<summary>Click to get a list of all dependencies</summary> <summary>Click to get a list of all dependencies</summary>

View File

@ -9,7 +9,7 @@ loader_version=0.14.19
fabric_api_version=0.81.3+1.20 fabric_api_version=0.81.3+1.20
# viafabricplus # viafabricplus
mod_version=2.7.2 mod_version=2.7.3
maven_group=de.florianmichael maven_group=de.florianmichael
archives_base_name=viafabricplus archives_base_name=viafabricplus

View File

@ -26,7 +26,7 @@ import java.security.NoSuchAlgorithmException;
public interface IClientConnection { public interface IClientConnection {
void viafabricplus_setupPreNettyEncryption(); void viafabricplus_setupPreNettyDecryption();
InetSocketAddress viafabricplus_capturedAddress(); InetSocketAddress viafabricplus_capturedAddress();
void viafabricplus_captureAddress(final InetSocketAddress socketAddress); void viafabricplus_captureAddress(final InetSocketAddress socketAddress);

View File

@ -62,9 +62,6 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
@Unique @Unique
private Cipher viafabricplus_decryptionCipher; private Cipher viafabricplus_decryptionCipher;
@Unique
private Cipher viafabricplus_encryptionCipher;
@Unique @Unique
private boolean viafabricplus_compressionEnabled = false; private boolean viafabricplus_compressionEnabled = false;
@ -81,7 +78,7 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
if (ProtocolHack.getTargetVersion(channel).isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (ProtocolHack.getTargetVersion(channel).isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
ci.cancel(); ci.cancel();
this.viafabricplus_decryptionCipher = decryptionCipher; this.viafabricplus_decryptionCipher = decryptionCipher;
this.viafabricplus_encryptionCipher = encryptionCipher; this.viafabricplus_setupPreNettyEncryption(encryptionCipher);
} }
} }
@ -111,10 +108,16 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
DisconnectConnectionCallback.EVENT.invoker().onDisconnect(); DisconnectConnectionCallback.EVENT.invoker().onDisconnect();
} }
@Unique
public void viafabricplus_setupPreNettyEncryption(final Cipher encryptionCipher) {
this.encrypted = true;
this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_LEGACY_PRE_NETTY_LENGTH_REMOVER_HANDLER_NAME, "encrypt", new PacketEncryptor(encryptionCipher));
}
@Override @Override
public void viafabricplus_setupPreNettyEncryption() { public void viafabricplus_setupPreNettyDecryption() {
this.encrypted = true;
this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_LEGACY_PRE_NETTY_LENGTH_PREPENDER_HANDLER_NAME, "decrypt", new PacketDecryptor(this.viafabricplus_decryptionCipher)); this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_LEGACY_PRE_NETTY_LENGTH_PREPENDER_HANDLER_NAME, "decrypt", new PacketDecryptor(this.viafabricplus_decryptionCipher));
this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_LEGACY_PRE_NETTY_LENGTH_REMOVER_HANDLER_NAME, "encrypt", new PacketEncryptor(this.viafabricplus_encryptionCipher));
} }
@Override @Override

View File

@ -29,7 +29,7 @@ public class ViaFabricPlusEncryptionProvider extends EncryptionProvider {
public void enableDecryption(UserConnection user) { public void enableDecryption(UserConnection user) {
final ClientConnection clientConnection = user.getChannel().attr(ProtocolHack.LOCAL_MINECRAFT_CONNECTION).get(); final ClientConnection clientConnection = user.getChannel().attr(ProtocolHack.LOCAL_MINECRAFT_CONNECTION).get();
if (clientConnection != null) { if (clientConnection != null) {
((IClientConnection) clientConnection).viafabricplus_setupPreNettyEncryption(); ((IClientConnection) clientConnection).viafabricplus_setupPreNettyDecryption();
} }
} }
} }