You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-42Lines changed: 8 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,51 +54,17 @@ If you just want the latest jar file you can download it from [GitHub Actions](h
54
54
55
55
## Usage
56
56
ViaLegacy requires you to have an already functional ViaVersion implementation for your platform.
57
-
If you don't have one you can check out [ViaLoader](https://github.com/ViaVersion/ViaLoader) for an abstracted and simplified, but still customizable implementation.
58
-
You can also go to the other [ViaVersion](https://github.com/ViaVersion) repositories and look at their server and proxy implementations.
57
+
If you don't have one you can check out [this documentation](https://github.com/ViaVersion/ViaVersion/wiki/Creating-a-new-ViaVersion-platform) in order to create one.
59
58
60
59
### Base Implementation
61
-
Note: In case you use [ViaLoader](https://github.com/ViaVersion/ViaLoader) you can skip "ViaLegacy platform implementation" and "Loading the platform" as ViaLoader already does that for you.
62
60
63
-
#### ViaLegacy platform implementation
64
-
To get started you should create a class which implements the ViaLegacy platform interface.
61
+
To implement ViaLegacy you need to create a new instance of its platform implementation class ``ViaLegacyPlatformImpl`` when ViaVersion is being enabled.
Make sure to add the enable listener before the Via manager is initialized (``((ViaManagerImpl) Via.getManager()).init();``).
66
+
This should be done in your ``ViaManagerImpl.initAndLoad()`` method call as enable listener (or otherwise after the Via manager is initialized).
94
67
95
-
It is also highly recommended to increase the max protocol path size of ViaVersion. Thedefault value is 50 which means there can't be more than 50 protocols in one pipeline. This can get exceeded by ViaLegacy.
96
-
You can increase the path size by adding the following lines after the Via manager is initialized:
97
-
```java
98
-
Via.getManager().getProtocolManager().setMaxProtocolPathSize(Integer.MAX_VALUE); // Allow Integer.MAX_VALUE protocols in the pipeline
((ProtocolManagerImpl) Via.getManager().getProtocolManager()).refreshVersions(); // Refresh the version paths
101
-
```
102
68
#### Implementing the netty changes
103
69
ViaLegacy requires you to make some changes to your netty pipeline where ViaVersion is being added into the pipeline.
104
70
ViaLegacy needs to have custom netty handlers in the pipeline which handle <= 1.6.4 connections. This is required due to the way how <= 1.6.4 (called pre-netty protocol) protocol differs.
@@ -107,13 +73,13 @@ To implement the changes you should add something similar to the following lines
107
73
```java
108
74
if (serverTargetVersion.olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { // Only add those handlers if the server version is <= 1.6.4
109
75
// You can either add a codec (if your pipeline is built for that)
110
-
channel.pipeline().addBefore("length-codec", "vialegacy-pre-netty-length-codec", new PreNettyLengthCodec(user));
// channel.pipeline().addBefore("length-decoder", "vialegacy-pre-netty-length-prepender", new PreNettyLengthPrepender(user));
113
-
// channel.pipeline().addBefore("length-encoder", "vialegacy-pre-netty-length-remover", new PreNettyLengthRemover(user));
78
+
// channel.pipeline().addBefore("length-decoder", PreNettyLengthPrepender.NAME, new PreNettyLengthPrepender(user));
79
+
// channel.pipeline().addBefore("length-encoder", PreNettyLengthRemover.NAME, new PreNettyLengthRemover(user));
114
80
}
115
81
```
116
-
In case you use [ViaLoader](https://github.com/ViaVersion/ViaLoader) and the [VLPipeline](https://github.com/ViaVersion/ViaLoader/blob/main/src/main/java/net/raphimc/vialoader/netty/VLPipeline.java) (or the [VLLegacyPipeline](https://github.com/ViaVersion/ViaLoader/blob/main/src/main/java/net/raphimc/vialoader/netty/VLLegacyPipeline.java)), you don't need to make these modifications anymore, as the VLPipeline/VLLegacyPipeline already does it automatically.
82
+
117
83
### Implementing the platform specific providers
118
84
The platform specific providers are all optional (except for ``EncryptionProvider`` and ``GameProfileFetcher``) and only required if you want to use the features which require them.
119
85
To implement a provider you can simply call ``Via.getManager().getProviders().use(TheNameOfTheProvider.class, new YouImplementationOfThatProvider());`` after the Via manager is initialized.
0 commit comments