Proxy-Compatible-Forge
Proxy-Compatible-Forge copied to clipboard
feat: Update the mod to Minecraft 1.20.2.
I added support for Minecraft 1.20.2. I also removed some code related to the command nodes, and replaced them with a single @Overwrite. The downside of this approach is that PCF may not work properly when the server is not accessed through a Velocity proxy, but that can easily be fixed by adding a check in the WrappableArgumentNodeStubMixin class.
I also had to skip a single byte in the ModernForwarding class, not entirely sure why, but everything seems to work fine now.
How do you suggest a check in WrappableArgumentNodeStubMixin would work?
I have not tested this code yet, but I think adding a check if Initializer.modernForwardingInstance == null should work. This would skip the check to see if the argument type is part of the integrated argument types, always serializing the argument type normally.
// ...
var id = BuiltInRegistries.COMMAND_ARGUMENT_TYPE.getId(typeInfo);
// Add Initializer.modernForwardingInstance == null
if (Initializer.modernForwardingInstance == null || identifier != null && Initializer.integratedArgumentTypes.contains(identifier.toString())) {
buffer.writeVarInt(id);
((ArgumentTypeInfo) typeInfo).serializeToNetwork(argumentType, buffer);
} else {
// ...
Another solution could be a simple configuration value the user can toggle if command arguments should be written in a Velocity-friendly fashion.
Initially I wanted to stick closer to the current code and only modify the CommandsMixin class, but ambassador:commands did not appear to be in the NetworkContext's remoteChannels on my test server. I am not sure if I was looking in the wrong place, or if some other behavior changed (Proxy running Velocity 3.3.0-SNAPSHOT with Ambassador 1.4.4).
If you prefer I can move the proposed check back to the CommandsMixin class, and/or add the configuration value.
I'm not sure if I should merge this in it's current state because it removes and I would prefer the check was brought back.