-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forge client support (support integrating with node-minecraft-protocol-forge) #326
Conversation
Current status (testing against server: forge-1.8.9-11.15.0.1715 + mods/ironchest-1.8.9-6.0.121.768.jar):
No longer kicked, but need to handle the plugin channels and FML handshakes |
This may not be strictly necessary, in either case Forge server with -Dfml.debugNetworkHandshake=true logs: [14:26:03] [Netty Server IO PrismarineJS#3/INFO] [FML]: Client protocol version 2
Getting further, to the mod list exchange:
The mod list will likely need to come from the ServerListPing, since a client must match the server and does not really need to implement all of the mods (for most bots/scripts/clients expected as the use case of NMP). But if I send: mods: [
{name:'IronChest', version:'6.0.121.768'}
] get an error encoding the mods array:
|
Fixes Error: SizeOf error for mods.2.0.name : missing data type: string
Server ModList: [ { name: 'Forge', version: '11.15.0.1715' },
{ name: 'IronChest', version: '6.0.121.768' },
{ name: 'mcp', version: '9.18' },
{ name: 'FML', version: '8.0.99.99' } ] |
"type": "byte" | ||
}, | ||
|
||
// ServerHello |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(as I was saying in gitter), it might make more sense to use a big switch+ a mapper, like in https://github.com/PrismarineJS/prismarine-nbt/blob/master/nbt.json#L48 (or https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/transforms/serializer.js#L21 )
- mapper makes it possible for user to use the names (for example ServerHello instead of 0)
- the big switch probably makes more sense because fields are distinct between each kind of "packet" here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, that's what I wanted to do but couldn't figure out how, to do: investigate those references
Server debug logging for reference: https://gist.github.com/deathcap/2c31e498b2375053c0e0 The handshake completes, but exits immediately after the FML handshake completes update: fixed, don't run your Forge server with -Dfml.debugNetworkHandshake=true; |
Moved tagHost \0FML\0 into the plugin. It is now enabled when Note: the Note 2: the client_forge example demonstrates auto-negotiation, since that's the likely usage for Forge clients written with node-minecraft-protocol, but it could be refactored after #331 dynamic protocol support. Other enhancements/cleanup are possible, but I think this PR is good enough to pull at this point (pending any review feedback). |
PrismarineJS/node-minecraft-protocol#326 Forge client support
Looks good to me, but I think it belongs in its own repo.
|
Updated to fix conflicts with master but still needs to be moved into its own repo, re:gitter, agreed could be best served in a repository under the PrismarineJS organization in order to ease maintenance. src/client/forgeHandshake.js is easy to separate but will need to untangle the tagHost and autoVersion. |
@deathcap you should now be able to create a repo in PrismarineJS for that forge plugin . (Or move https://github.com/deathcap/node-minecraft-protocol-forge but then I think you should first remove almost all the commits, it's a plugin, not a nmp fork) |
Cool thanks. Yeah https://github.com/deathcap/node-minecraft-protocol-forge branched from this repo (based on this PR) but I should probably rebase to remove the pre-Forge commits which were since removed as part of moving to a new module, or save the old branch and make a new one just with src/client/forgeHandshake.js |
src/client/autoVersion.js has a dependency on src/client/forgeHandshake.js, though. I suppose it could be modified to support "hooks" into the response modinfo, which forgeHandshake could register itself as a handler somehow (for response.modinfo.type === 'FML', install itself with forgeMods: response.info.modList). |
Yes it would be better to remove that dependency somehow |
Well it's easy enough to remove the autoVersion/forgeHandshake dependency, but it would remove the feature :). The trickiness is in having the plugin add Forge support to autoVersion, without necessarily enabling it in the handshake. Maybe the node-Minecraft-protocol-forge module could expose two plugins (forgeHandshake and autoVersionForge?) |
Ref PrismarineJS#338 Move all the plugin-mutable options to client
Alright I've rebased https://github.com/deathcap/node-minecraft-protocol-forge, and updated this PR so it now only contains the changes needed to support node-minecraft-protocol-forge rather than the code itself. To allow auto-versioning Forge plugins, added a new "auto version hook" feature, where plugins can add their own handlers for the auto-version ping response. autoVersionForge uses this to install itself with the right mods. Example usages of these two plugins: var mc = require('minecraft-protocol');
var forgeHandshake = require('minecraft-protocol-forge').forgeHandshake;
var client = mc.createClient({
host: host,
port: port,
username: username,
password: password
});
forgeHandshake(client, {forgeMods: [
{ modid: 'mcp', version: '9.18' },
{ modid: 'FML', version: '8.0.99.99' },
{ modid: 'Forge', version: '11.15.0.1715' },
{ modid: 'IronChest', version: '6.0.121.768' }
]); and: var mc = require('minecraft-protocol');
var autoVersionForge = require('minecraft-protocol-forge').autoVersionForge;
var client = mc.createClient({
version: false,
host: host,
port: port,
username: username,
password: password
});
autoVersionForge(client); Not bad, imho. Open to other improvements but once these changes are in, will be able to publish node-minecraft-protocol-forge.
OK I tried to create a new repo in PrismarineJS but am only offered: can I just transfer https://github.com/deathcap/node-minecraft-protocol-forge to https://github.com/PrismarineJS/node-minecraft-protocol-forge? (there is a 'transfer' option in https://github.com/deathcap/node-minecraft-protocol-forge/settings but it is in the 'danger zone' so wanted to be sure) |
Yeah just use transfer. |
Looks good to me. Is this ready to merge ? |
Oh and you probably got an invitation to join prismarinejs in your mail, looks like you didn't accept it yet. |
Yep ready to merge! I'll check for the invite, won't let me transfer to PrismarineJS without it (says no rights) update: transfer complete: https://github.com/PrismarineJS/node-minecraft-protocol-forge |
Forge client support (support integrating with node-minecraft-protocol-forge)
Add client-side #114 Forge Support
forgeMods
event for app to checkNot included, out of scope for this PR: