This commit is contained in:
Lenni0451 2023-01-05 14:00:28 +01:00
commit 9514b7a48a
11 changed files with 153 additions and 18 deletions

View file

@ -1,5 +1,10 @@
# ViaProxy
Standalone proxy which uses ViaVersion to translate between minecraft versions.
Standalone proxy which uses ViaVersion to translate the protocol between minecraft versions.
ViaProxy allows you to join to essentially any minecraft version server from a modern client.
To download the latest version, go to the [Releases section](#executable-jar-file) and download the latest version.
Using it is very simple, just run the jar file, and it will start a user interface where everything can be configured.
For a full user guide go to the [Usage for Players](#usage-for-players-gui) section or the [Usage for Server Owners](#usage-for-server-owners-cli) section.
## Supported Server versions
- Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension))
@ -11,15 +16,55 @@ Standalone proxy which uses ViaVersion to translate between minecraft versions.
## Supported Client versions
- Release (1.7.2 - 1.19.3)
- April Fools (3D Shareware)
## Releases
### Executable Jar File
If you want the executable jar file you can download a stable release from [GitHub](https://github.com/RaphiMC/ViaProxy/releases/latest) or the latest version from this [Jenkins](https://build.lenni0451.net/job/ViaProxy/).
### Gradle/Maven
To use ViaProxy with Gradle/Maven you can use this [Maven server](https://maven.lenni0451.net/#/releases/net/raphimc/ViaProxy) or [Jitpack](https://jitpack.io/#RaphiMC/ViaProxy).
You can also find instructions how to implement it into your build script there.
### Jar File
If you just want the latest jar file you can download it from this [Jenkins](https://build.lenni0451.net/job/ViaProxy/).
## Usage for Players (GUI)
![ViaProxy GUI](https://i.imgur.com/N2JCvEp.png)
1. Download the latest version from the [Releases section](#executable-jar-file)
2. Put the jar file into a folder (ViaProxy will generate config files and store some data there)
3. Run the jar file
4. Fill in the required fields like server address and version
5. Click on "Start"
6. Join with your minecraft client on the displayed address
7. Have fun!
## Usage
TODO
## Usage for Server owners (CLI)
1. Download the latest version from the [Releases section](#executable-jar-file)
2. Put the jar file into a folder (ViaProxy will generate config files and store some data there)
3. Run the jar file (Using java -jar ViaProxy-whateverversion.jar --help)
4. Look at the available config options and use those you need just like you would in the GUI
5. Start the proxy using the start command and test whether it works (Join using the server's public address and the bind port you configured)
6. Have fun!
Here is an example command to allow players to join on yourserverip:25568 and connect to a beta 1.7.3 server running on port 25565:
``java -jar ViaProxy-whateverversion.jar --bind_port 25568 --target_ip 127.0.0.1 --target_port 25565 --version b1.7-b1.7.3``
## Advanced Usage
### Online Mode
If you want to join online mode servers you need to install the [OpenAuthMod](https://modrinth.com/mod/openauthmod) mod.
When you have the mod installed and select "OpenAuthMod" as authentication type in the GUI / CLI.
### Configuring the protocol translation
To change the protocol translation settings/features you can look into the ViaProtocolHack folder.
You will find 4 config files there:
- viaversion.yml (ViaVersion)
- config.yml (ViaBackwards)
- viarewind.yml (ViaRewind)
- vialegacy.yml (ViaLegacy)
### Developer Plugin API
ViaProxy has a plugin API which allows you to create plugins for ViaProxy.
You can find the documentation and examples [here](https://github.com/Lenni0451/NoLocalConnections).
## Contact
If you encounter any issues, please report them on the
[issue tracker](https://github.com/RaphiMC/ViaProxy/issues).
If you just want to talk or need help using ViaProxy feel free to join my
[Discord](https://discord.gg/dCzT9XHEWu).

View file

@ -1,6 +1,7 @@
plugins {
id "java"
id "maven-publish"
id "net.kyori.blossom" version "1.3.1"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
@ -60,8 +61,8 @@ dependencies {
include "net.raphimc.netminecraft:all:2.2.2"
}
java {
withSourcesJar()
blossom {
replaceToken("\${version}", project.version, "src/main/java/net/raphimc/viaproxy/ViaProxy.java")
}
jar {

View file

@ -29,6 +29,8 @@ import java.awt.*;
public class ViaProxy {
public static final String VERSION = "${version}";
public static NetServer currentProxyServer;
public static Thread loaderThread;
public static ChannelGroup c2pChannels;
@ -46,7 +48,7 @@ public class ViaProxy {
public static void injectedMain(String[] args) throws InterruptedException {
Logger.setup();
ConsoleHandler.hookConsole();
Logger.LOGGER.info("Initializing ViaProxy...");
Logger.LOGGER.info("Initializing ViaProxy v" + VERSION + "...");
VersionEnum.init();
setNettyParameters();
MCPipeline.useOptimizedPipeline();
@ -70,7 +72,7 @@ public class ViaProxy {
Options.parse(args);
} catch (Throwable t) {
Logger.LOGGER.fatal("[" + t.getClass().getSimpleName() + "] " + t.getMessage());
return;
System.exit(0);
}
loaderThread.start();

View file

@ -1,14 +1,13 @@
package net.raphimc.viaproxy.protocolhack;
import net.raphimc.viaprotocolhack.ViaProtocolHack;
import net.raphimc.viaprotocolhack.impl.platform.*;
import net.raphimc.viaproxy.protocolhack.impl.ViaProxyVPLoader;
import net.raphimc.viaproxy.protocolhack.impl.ViaProxyViaVersionPlatformImpl;
import net.raphimc.viaprotocolhack.impl.platform.ViaLegacyPlatformImpl;
import net.raphimc.viaproxy.protocolhack.impl.*;
public class ProtocolHack {
public static void init() {
ViaProtocolHack.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVPLoader(), null, null, ViaBackwardsPlatformImpl::new, ViaRewindPlatformImpl::new, ViaLegacyPlatformImpl::new);
ViaProtocolHack.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVPLoader(), null, null, ViaProxyViaBackwardsPlatformImpl::new, ViaProxyViaRewindPlatformImpl::new, ViaLegacyPlatformImpl::new);
}
}

View file

@ -0,0 +1,23 @@
package net.raphimc.viaproxy.protocolhack.impl;
import com.viaversion.viabackwards.ViaBackwardsConfig;
import net.raphimc.viaprotocolhack.impl.platform.ViaBackwardsPlatformImpl;
import java.io.File;
import java.net.URL;
public class ViaProxyViaBackwardsPlatformImpl extends ViaBackwardsPlatformImpl {
@Override
public void init(File dataFolder) {
new ViaBackwardsConfig(new File(dataFolder, "config.yml")) {
@Override
public URL getDefaultConfigURL() {
return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viabackwards.yml");
}
}.reloadConfig();
super.init(dataFolder);
}
}

View file

@ -0,0 +1,35 @@
package net.raphimc.viaproxy.protocolhack.impl;
import com.viaversion.viaversion.api.Via;
import de.gerrygames.viarewind.api.ViaRewindConfigImpl;
import de.gerrygames.viarewind.api.ViaRewindPlatform;
import net.raphimc.viaprotocolhack.util.JLoggerToSLF4J;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.URL;
import java.util.logging.Logger;
public class ViaProxyViaRewindPlatformImpl implements ViaRewindPlatform {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaRewind"));
public ViaProxyViaRewindPlatformImpl() {
new ViaRewindConfigImpl(new File(Via.getPlatform().getDataFolder(), "viarewind.yml")) {
@Override
public URL getDefaultConfigURL() {
return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viarewind.yml");
}
}.reloadConfig();
final ViaRewindConfigImpl config = new ViaRewindConfigImpl(new File(Via.getPlatform().getDataFolder(), "viarewind.yml"));
config.reloadConfig();
this.init(config);
}
@Override
public Logger getLogger() {
return LOGGER;
}
}

View file

@ -1,8 +1,12 @@
package net.raphimc.viaproxy.protocolhack.impl;
import com.viaversion.viaversion.configuration.AbstractViaConfig;
import net.raphimc.viaprotocolhack.impl.platform.ViaVersionPlatformImpl;
import net.raphimc.viaprotocolhack.impl.viaversion.VPViaConfig;
import net.raphimc.viaproxy.cli.ConsoleFormatter;
import java.io.File;
import java.net.URL;
import java.util.UUID;
public class ViaProxyViaVersionPlatformImpl extends ViaVersionPlatformImpl {
@ -16,4 +20,16 @@ public class ViaProxyViaVersionPlatformImpl extends ViaVersionPlatformImpl {
super.sendMessage(uuid, ConsoleFormatter.convert(msg));
}
@Override
protected AbstractViaConfig createConfig() {
new VPViaConfig(new File(this.getDataFolder(), "viaversion.yml")) {
@Override
public URL getDefaultConfigURL() {
return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viaversion.yml");
}
}.reloadConfig();
return super.createConfig();
}
}

View file

@ -61,7 +61,7 @@ public class ViaProxyUI extends JFrame {
}
private void initWindow() {
this.setTitle("ViaProxy");
this.setTitle("ViaProxy v" + ViaProxy.VERSION);
this.setIconImage(this.icon.getImage());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(500, 370);
@ -131,7 +131,7 @@ public class ViaProxyUI extends JFrame {
this.contentPane.add(this.serverVersion);
}
{
JLabel bindPortLabel = new JLabel("Bind Port:");
JLabel bindPortLabel = new JLabel("Local Port:");
bindPortLabel.setBounds(10, 150, 100, 20);
this.contentPane.add(bindPortLabel);
@ -142,8 +142,8 @@ public class ViaProxyUI extends JFrame {
this.contentPane.add(this.bindPort);
}
{
JLabel authMethodLabel = new JLabel("Auth Method:");
authMethodLabel.setBounds(10, 200, 100, 20);
JLabel authMethodLabel = new JLabel("Server Online Mode Auth Method:");
authMethodLabel.setBounds(10, 200, 250, 20);
this.contentPane.add(authMethodLabel);
this.authMethod = new JComboBox<>(new String[]{"OpenAuthMod"});

View file

@ -0,0 +1,4 @@
#Overwrite default value
fix-1_13-face-player: true
#Overwrite default value
handle-pings-as-inv-acknowledgements: true

View file

@ -0,0 +1,4 @@
#Overwrite default value
replace-adventure: true
#Overwrite default value
replace-particles: true

View file

@ -0,0 +1,6 @@
#Overwrite default value
1_13-tab-complete-delay: 5
#Overwrite default value
no-delay-shield-blocking: true
#Overwrite default value
chunk-border-fix: true