Updated ViaBedrock to support 1.20.80

This commit is contained in:
RaphiMC 2024-05-01 21:59:37 +02:00
parent 0353a9323b
commit 2f7b134dfd
No known key found for this signature in database
GPG key ID: 0F6BB0657A03AC94
4 changed files with 8 additions and 13 deletions

View file

@ -12,7 +12,7 @@ For a full user guide go to the [Usage for Players](#usage-for-players-gui) sect
- Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension))
- April Fools (3D Shareware, 20w14infinite)
- Combat Snapshots (Combat Test 8c)
- Bedrock Edition 1.20.70 ([Some features are missing](https://github.com/RaphiMC/ViaBedrock#features))
- Bedrock Edition 1.20.80 ([Some features are missing](https://github.com/RaphiMC/ViaBedrock#features))
## Supported Client versions
- Release (1.7.2 - 1.20.6)

View file

@ -59,7 +59,7 @@ dependencies {
include "com.viaversion:viarewind-common:3.1.1-SNAPSHOT"
include "net.raphimc:ViaLegacy:2.2.23-SNAPSHOT"
include "net.raphimc:ViaAprilFools:2.0.12-SNAPSHOT"
include("net.raphimc:ViaBedrock:0.0.6-SNAPSHOT") {
include("net.raphimc:ViaBedrock:0.0.7-SNAPSHOT") {
exclude group: "io.netty"
exclude group: "io.jsonwebtoken"
}

View file

@ -17,12 +17,12 @@
*/
package net.raphimc.viaproxy.protocoltranslator.impl;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.TransferProvider;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.CompressionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import net.raphimc.viabedrock.protocol.providers.NettyPipelineProvider;
import net.raphimc.viabedrock.protocol.providers.TransferProvider;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicCustomCommandProvider;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicWorldHeightProvider;
@ -46,7 +46,7 @@ public class ViaProxyVLLoader extends VLLoader {
Via.getManager().getProviders().use(VersionProvider.class, new ViaProxyVersionProvider());
// ViaBackwards
Via.getManager().getProviders().use(com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.TransferProvider.class, new ViaProxyTransferProvider());
Via.getManager().getProviders().use(TransferProvider.class, new ViaProxyTransferProvider());
// ViaLegacy
Via.getManager().getProviders().use(GameProfileFetcher.class, new ViaProxyGameProfileFetcher());
@ -58,7 +58,6 @@ public class ViaProxyVLLoader extends VLLoader {
// ViaBedrock
Via.getManager().getProviders().use(NettyPipelineProvider.class, new ViaProxyNettyPipelineProvider());
Via.getManager().getProviders().use(TransferProvider.class, new ViaProxyTransferProvider());
// ViaProxy plugins
ViaProxy.EVENT_MANAGER.call(new ViaLoadingEvent());

View file

@ -17,20 +17,21 @@
*/
package net.raphimc.viaproxy.protocoltranslator.providers;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.TransferProvider;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.CookieStorage;
import com.viaversion.viaversion.api.connection.UserConnection;
import io.netty.channel.Channel;
import net.raphimc.viabedrock.protocol.providers.TransferProvider;
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
import net.raphimc.viaproxy.proxy.util.CloseAndReturn;
import net.raphimc.viaproxy.proxy.util.TransferDataHolder;
import java.net.InetSocketAddress;
public class ViaProxyTransferProvider extends TransferProvider implements com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.TransferProvider {
public class ViaProxyTransferProvider implements TransferProvider {
@Override
public void connectToServer(UserConnection user, InetSocketAddress newAddress) {
public void connectToServer(UserConnection user, String host, int port) {
final InetSocketAddress newAddress = new InetSocketAddress(host, port);
final Channel channel = ProxyConnection.fromChannel(user.getChannel()).getC2P();
TransferDataHolder.addTempRedirect(channel, newAddress);
if (user.has(CookieStorage.class)) {
@ -42,9 +43,4 @@ public class ViaProxyTransferProvider extends TransferProvider implements com.vi
}
}
@Override
public void connectToServer(UserConnection user, String host, int port) {
this.connectToServer(user, new InetSocketAddress(host, port));
}
}