兼容代理的 Forge
特别感谢 FabricProxy-Lite 和 CrossStitch 在模组化代理领域做出的开创性工作。我们在将相关内容移植并适配到 Neo/Forge 环境方面做了大量工作,但我们的成就依然建立在巨人的肩膀之上。
此模组将 Velocity 的 现代、 Lucko 的 BungeeGuard 以及 BungeeCord 的传统玩家信息转发模式引入 Neo/Forge 服务器。
支持版本/平台
- Forge 1.7.2 - 26.2
- Forge 1.14 - 1.15.1 需要 MixinBootstrap
- Forge 1.13.x 需要 ModernMixins
- Forge 1.8 - 1.12.2 需要 MixinBooter
- Forge 1.7.x 需要 UniMixins
- 1.7.2 - 1.12.2 还需要修改过的 Velocity 代理
- NeoForge 1.20.1 - 26.2
- SpongeForge/SpongeNeo
- 通常不需要 PCF,因为 Sponge 原生支持传统与现代转发模式及命令参数包装
- 但是,如果安装了 Forgified Fabric API(特别是
fabric_networking_api_v1),你可能需要使用 PCF 并禁用 Sponge 的转发功能
- Bukkit+Neo/Forge 混合服务器
- 尽可能使用混合服务器内置的转发支持;否则,如果其实现不兼容,则使用 PCF
请参阅 Compatibility 页面以获取更多关于支持平台和整合包的详细信息。
入门指南
关于 Forge 1.13 - 1.20.1 的注意事项
如果你希望在 Velocity 代理后面托管现代版本的 Forge 服务器 (1.13 - 1.20.1),请查看 Ambassador:
注意:Ambassador 1.2.0-beta 或更高版本不再需要此模组,但如果你希望使用现代转发功能,你仍然可以继续使用它。
安装
以下操作假设你已经 配置了 Velocity 代理 并且拥有一个正常运行的设置。
- 下载此模组并将其放入你的 Neo/Forge 服务器的
mods文件夹中(Jar 文件可在 Modrinth 或发布标签页中找到)。 - 启动 Neo/Forge 服务器以生成默认配置文件。
- 停止 Neo/Forge 服务器。
- 打开
config文件夹中的proxy-compatible-forge.toml,并将你的转发密钥填入forwarding.secret配置项中。 - 在
server.properties中确保online-mode设置为false。 - 你现在可以启动服务器并通过 Velocity 连接了!
配置
配置文件位于 config/proxy-compatible-forge.toml,包含以下选项:
| 设置组 | 设置名称 | 默认值 | 描述 |
|---|---|---|---|
forwarding |
enabled |
true |
启用或禁用玩家信息转发。更改此设置需要重启服务器。 |
forwarding |
mode |
"MODERN" |
要使用的转发类型。 |
forwarding |
secret |
"" |
用于验证玩家连接来自受信任代理的密钥。 |
forwarding |
approvedProxyHosts |
[] |
批准的代理主机名或 IP 地址列表。如果连接的代理的主机名或 IP 不在此列表中,玩家将被断开连接。留空则允许所有连接。 |
crossStitch |
enabled |
true |
启用或禁用 CrossStitch 支持。更改此设置需要重启服务器。 |
crossStitch |
forceWrappedArguments |
[] |
在此处添加任何不兼容的模组或原版命令参数类型。 |
crossStitch |
forceWrapVanillaArguments |
false |
强制包装原版命令参数类型。当上述设置变得过于冗长时很有用。 |
debug |
enabled |
false |
启用或禁用调试日志记录。 |
debug |
disabledMixins |
[] |
要禁用的 Mixin 列表。使用 Mixin 的名称并以其部分或完整包名为前缀。 |
advanced |
modernForwardingVersion |
"NO_OVERRIDE" |
覆盖 PCF 决定的现代转发版本。如果遇到聊天签名问题,请将其更改为 "MODERN_DEFAULT"。更改此设置需要重启服务器。 |
功能
玩家信息转发
如上所述,PCF 实现了 Velocity 的 MODERN 转发协议,允许你在代理后面保护模组服务器。
支持现代转发版本 1-4:
| 名称 | 值 | 支持的 MC 版本 |
|---|---|---|
MODERN_DEFAULT |
1 | 任意版本 |
MODERN_FORWARDING_WITH_KEY |
2 | 1.19 |
MODERN_FORWARDING_WITH_KEY_V2 |
3 | 1.19.1 - 1.19.2 |
MODERN_LAZY_SESSION |
4 | 1.19.3 及以上版本 |
如果你遇到与聊天签名相关的兼容性问题,请报告该问题,然后将 PCF 配置中的 advanced.modernForwardingVersion 更改为 MODERN_DEFAULT。
接下来,BUNGEEGUARD 转发要求你要么使用 Velocity 的 BUNGEEGUARD 转发模式,要么在使用 BungeeCord 的同时安装 BungeeGuard 插件。
最后,LEGACY 转发要求你使用 Velocity 的 LEGACY 转发模式或在启用 IP 转发的情况下使用 BungeeCord。建议你不要使用这种转发模式,但你可以使用 forwarding.approvedProxyHosts 设置来在一定程度上确保安全。
模组命令参数包装,即 CrossStitch
这解决了如下错误:
io.netty.handler.codec.CorruptedFrameException: Error decoding class com.velocitypowered.proxy.protocol.packet.AvailableCommandsPacket
PCF 移植了该 Fabric 模组的封装模组命令参数的能力,使其能够通过 Velocity 发送,而无需为每个模组添加的命令参数创建自定义数据包反序列化器。请注意,BungeeCord 不支持包装的命令参数,因此如果你使用(或运行 BungeeCord 的分支),你可能需要禁用此功能。
在极少数情况下,模组会在 minecraft 命名空间下注册其命令参数或对原版参数进行修改,从而绕过 PCF 的参数包装器。在这种情况下,你可以将自定义参数的 ID 添加到 PCF 的 crossStitch.forceWrappedArguments 设置中,以强制 PCF 包装该参数。
在模组在原版之前注入并注册其参数、导致所有参数 ID 值偏移的情况下,你可以启用 crossStitch.forceWrapVanillaArguments 设置以强制包装 minecraft 和 brigadier 命名空间。这更像是一种临时解决方案,因为偏移后的参数 ID 无法被 Velocity 读取,并且如果客户端上的参数 ID 具有相同的偏移量,客户端将无法读取 Velocity 命令,从而导致完全无法连接,除非你通过权限禁用代理上的所有命令或删除添加命令的插件。
判断是否发生这种情况的最简单方法是启用 PCF 配置中的调试日志记录,并检查 brigadier:boolean 是否具有除 0 以外的参数 ID。
一个常见的修复方法是让相关模组将其注册 mixin 移至 RETURN,并确保其参数的注册指定了其 modid 作为命名空间。
如果你发现任何异常的参数(wild args),请提交 Issue,以便我们可以将它们添加到默认配置中,或者利用提供的信息为该模组的问题编写 PR。
常见问题
频道过多
客户端错误:
Invalid payload REGISTER!
Velocity:
Velocity 修复:在 Velocity 的启动参数中添加 -Dvelocity.max-known-packs=#,
其中 # 是一个数字,计算方式为 64 + 模组数量 * 1.5(向上取整)。
例如:对于 40 个模组,使用 64 + 40*1.5 = 124,即 -Dvelocity.max-known-packs=124
Paper 服务器错误:
[00:00:00 ERROR]: Couldn't register custom payload
java.lang.IllegalStateException: Cannot register channel 'modid:channel'. Too many channels registered!
Paper 修复:在 Paper 服务器的启动参数中添加 -Dpaper.disableChannelLimit=true
注意:由于涉及的频道和模组数量众多,加入原版服务器时,客户端可能会出现纹理/物品不匹配的情况。
发生内部服务器连接错误
客户端错误:
An internal server connection error occurred.
Velocity 错误:
io.netty.handler.codec.CorruptedFrameException: Packet sent for class com.velocitypowered.proxy.protocol.packet.PluginMessagePacket was too big (expected 1234567 bytes, got 7654321 bytes)
通过在 Velocity 的启动参数中添加 -Dvelocity.max-plugin-message-payload-size=####### 解决 Velocity 端的问题,
其中 ####### 比错误信息中最后一个 "got ####### bytes" 的数字稍大一些。重复此操作直到你的客户端能够成功登录。
构建项目
-
克隆仓库。
git clone https://github.com/adde0109/Proxy-Compatible-Forge.git -
在项目根目录下运行
./gradlew build(Windows 系统下为gradlew.exe build) -
jar 文件将位于
build/libs/
Proxy Compatible Forge
Special thanks to FabricProxy-Lite and CrossStitch for spearheading in the modded proxy space. We've done our fair share of work porting things and tailoring them to a Neo/Forge environment, but nonetheless we stand on the shoulders of giants.
This mod brings Velocity's modern, Lucko's BungeeGuard, and BungeeCord's legacy player info forwarding modes to Neo/Forge servers.
Supported Versions/Platforms
- Forge versions 1.7.2 - 26.2
- MixinBootstrap is required on Forge 1.14 - 1.15.1
- ModernMixins is required on Forge 1.13.x
- MixinBooter is required on Forge 1.8 - 1.12.2
- UniMixins is required on Forge 1.7.x
- 1.7.2 - 1.12.2 also require a modified Velocity proxy
- NeoForge versions 1.20.1 - 26.2
- SpongeForge/SpongeNeo
- PCF shouldn't be needed, as Sponge supports legacy+modern forwarding and command argument wrapping
- However, if Forgified Fabric API is installed (specifically
fabric_networking_api_v1), you may need to use PCF and disable Sponge's forwarding
- Bukkit+Neo/Forge Hybrid servers
- Use the Hybrid's built-in forwarding support when possible, otherwise use PCF if their implementation is incompatible
See the Compatibility page for more details on supported platforms and modpacks.
How to Get Started
Note Regarding Forge 1.13 - 1.20.1
If you wish to host modern Forge server (1.13 - 1.20.1) behind a Velocity proxy, check out Ambassador:
Note: Version 1.2.0-beta or higher of Ambassador doesn't require this mod anymore, but you can still use it if you want modern forwarding.
Installation
The following assumes you've already configured a Velocity proxy and have a functional setup.
- Download this mod and place it in your Neo/Forge server's
modsfolder (Jars can be found on Modrinth or in the releases tab). - Start the Neo/Forge server to generate the default config file.
- Stop the Neo/Forge server.
- Open
proxy-compatible-forge.tomlin theconfigfolder and put your forwarding secret in theforwarding.secretconfig field. - In
server.propertiesmake sureonline-modeis set tofalse. - You are now ready to start the server and connect to it with Velocity!
Configuration
The config is located under config/proxy-compatible-forge.toml and has the following options:
| Setting Group | Setting Name | Default Value | Description |
|---|---|---|---|
forwarding |
enabled |
true |
Enable or disable player info forwarding. Changing this setting requires a server restart. |
forwarding |
mode |
"MODERN" |
The type of forwarding to use. |
forwarding |
secret |
"" |
The secret used to verify the player's connection is coming from a trusted proxy. |
forwarding |
approvedProxyHosts |
[] |
A list of approved proxy hostnames or IP addresses. If the connecting proxy's hostname or IP isn't in this list, the player will be disconnected. Leave empty to allow all. |
crossStitch |
enabled |
true |
Enable or disable CrossStitch support. Changing this setting requires a server restart. |
crossStitch |
forceWrappedArguments |
[] |
Add any incompatible modded or vanilla command argument types here. |
crossStitch |
forceWrapVanillaArguments |
false |
Force wrap vanilla command argument types. Useful for when the above setting gets a bit excessive. |
debug |
enabled |
false |
Enable or disable debug logging. |
debug |
disabledMixins |
[] |
List of mixins to disable. Use the Mixin's name and prefix it with it's partial or full package name. |
advanced |
modernForwardingVersion |
"NO_OVERRIDE" |
Overrides the modern forwarding version decided by PCF. Change it to "MODERN_DEFAULT" if you encounter chat-signing issues. Changing this setting requires a server restart. |
Features
Player Info Forwarding
As mentioned above, PCF implements Velocity's MODERN forwarding protocol, allowing you to secure modded
servers behind proxies.
Modern Forwarding versions 1-4 are supported:
| Name | Value | Supported MC Versions |
|---|---|---|
MODERN_DEFAULT |
1 | Any |
MODERN_FORWARDING_WITH_KEY |
2 | 1.19 |
MODERN_FORWARDING_WITH_KEY_V2 |
3 | 1.19.1 - 1.19.2 |
MODERN_LAZY_SESSION |
4 | 1.19.3 and above |
If you run into compatibility issues regarding chat signing, report the issue, then change
advanced.modernForwardingVersion to MODERN_DEFAULT in PCF's config.
Next, BUNGEEGUARD forwarding requires you to either use Velocity's BUNGEEGUARD forwarding mode, or use BungeeCord
with the BungeeGuard plugin installed.
Lastly, LEGACY forwarding requires you to use Velocity's LEGACY forwarding mode or BungeeCord with IP forwarding enabled.
It is advised that you do not use this forwarding mode, but you can use the forwarding.approvedProxyHosts setting to somewhat secure things.
Modded Command Argument Wrapping, aka CrossStitch
This resolves errors such as:
io.netty.handler.codec.CorruptedFrameException: Error decoding class com.velocitypowered.proxy.protocol.packet.AvailableCommandsPacket
PCF ports this Fabric mod's ability to wrap modded command arguments, allowing them to be sent through Velocity without there needing to be a custom packet deserializer for each and every command argument mods add. Please note that BungeeCord does not support wrapped command arguments, so you will likely need to disable this feature if you use (or run a fork of) BungeeCord.
In some rare cases mods will register their command arguments under the minecraft namespace or make modifications to
vanilla arguments, bypassing PCF's argument wrapper. In such cases, you can add the custom argument's ID to PCF's
crossStitch.forceWrappedArguments setting to force PCF to wrap the argument.
In situations where mods inject and register their arguments before Vanilla does, offsetting all the argument ID values,
you can enable the crossStitch.forceWrapVanillaArguments setting to force-wrap the minecraft and brigadier namespaces.
This is more of a band-aid solution as the offset argument IDs cannot be read by Velocity, and if the argument IDs on
the client have the same offset Velocity commands cannot be read by the client, preventing connections entirely unless
you disable all commands on the proxy via permissions or by removing plugins that add commands.
The easiest way to tell if this is happening is to enable PCF's debug logging in the config and check to see if
brigadier:boolean has an argument ID other than 0.
A common fix for this is for the mod in question to move their registration mixin to RETURN, and to ensure that their
argument's registration specifies their modid as the namespace.
If you find any wild args, please open an issue so we can add them to the default config, or so we can use the information provided to write up a PR for the mod causing the issue.
Common Issues
Too Many Channels
Client Error:
Invalid payload REGISTER!
Velocity:
Velocity Fix: Add -Dvelocity.max-known-packs=# to the Velocity's startup arguments,
where # is a number that is 64 + number-of-mods*1.5 (round up).
Eg: For 40 mods, use 64 + 40*1.5 = 124, so -Dvelocity.max-known-packs=124
Paper Server Error:
[00:00:00 ERROR]: Couldn't register custom payload
java.lang.IllegalStateException: Cannot register channel 'modid:channel'. Too many channels registered!
Paper Fix: Add -Dpaper.disableChannelLimit=true to the Paper server's startup arguments
Notes: Due to the amount of channels and mods at play, textures/items may be mismatched on the client when joining a Vanilla server.
An internal server connection error occurred
Client Error:
An internal server connection error occurred.
Velocity Error:
io.netty.handler.codec.CorruptedFrameException: Packet sent for class com.velocitypowered.proxy.protocol.packet.PluginMessagePacket was too big (expected 1234567 bytes, got 7654321 bytes)
Resolved Velocity-side with the by adding -Dvelocity.max-plugin-message-payload-size=####### to Velocity's startup arguments,
where ####### is a bit larger than the last "got ####### bytes" number in the error message. Repeat until your client is able to log in.
Building the Project
-
Clone the repository.
git clone https://github.com/adde0109/Proxy-Compatible-Forge.git -
Run
./gradlew build(gradlew.exe buildon Windows) in the root directory of the project -
The jar will be in
build/libs/
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Proxy Compatible Forge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
模组
添加区块认领和玩家组队功能,并与 Xaero's Minimap 和 World Map 集成
评论 0
登录后参与评分
还没有评论,来抢沙发吧