node-minecraft-protocol icon indicating copy to clipboard operation
node-minecraft-protocol copied to clipboard

Partially connects to 1.7.10 FTB Infinity Evolved Server

Open macharborguy opened this issue 9 years ago • 4 comments

I am attempting to get our custom bot to connect to our FTB Infinity Evolved server.

Server is 1.7.10 Minecraft-Protocol is 1.0.0

I am printing all of the State, Packet and Raw events to the console. This is the order that the events come in (minus the raw events, since they are just redundant copies of the state and packet events).

State: Login/Handshaking Packet: 0: ServerID, publicKey, verifyToken, 1: encryption_begin login packet: 0: uuid and username 1: success login state: 0: play 1: login packet: 0: channel REGISTER, 1: custom_payload play packet: 0: channel: FML | HS, 1: custom_payload play

after that, i receive KeepAlive packets every few seconds.

The bot never appears in the user list, nor do we see a "botname has joined" message. If I close out of the NodeJS app, we DO see "botname has left the game".

The "Chat" event does not fire when players post to the chat area either, so it would appear that the bot is partially connecting, but not getting all the way there.

The bot is whitelisted and the whitelist was reloaded.

Any suggestions? The install of the server is a baseline, normal install of FTB Infinity Evolved, latest version running on 1.7.10, no changes to the config except for extending Elevator block distances.

Here is the code I am using, minus the event listeners, as those are just filled with "console.log()" at the moment.

var mc = require('minecraft-protocol');
console.log('Connecting to MC Server');
let mcBot = mc.createClient({
    username: 'username',
    password: 'password',
    host: "localhost",
    port: 25565,
    version: '1.7.10'
});

Its just the most basic connection code, nothing fancy yet.

macharborguy avatar Jun 30 '16 02:06 macharborguy

It looks like you need to use https://github.com/PrismarineJS/node-minecraft-protocol-forge

rom1504 avatar Jun 30 '16 08:06 rom1504

Installed node-minecraft-protocol-forge and am attempting to use the auto-versioning setup since I dont have a complete JSON list of all the mods. I get the following Stack Trace...

 "TypeError: Cannot read property 'pc' of undefined",
        "    at /botdirectory/node_modules/minecraft-protocol/dist/client/autoVersion.js:36:82",

Looking and console.logging the variables at that particular line of code...

var versionInfo = minecraft_data.versionsByMinecraftVersion[minecraftVersion]["pc"];

a console.log of "minecraft_data.versionsByMinecraftVersion["1.7.10"] does not show any property called "PC", but instead...

'1.7.10': 
      { minecraftVersion: '1.7.10',
        version: 5,
        usesNetty: true,
        majorVersion: '1.7' },

Should the code be changed in the module itself so that instead of looking for a property named "PC" it looks for "version"?

macharborguy avatar Jun 30 '16 14:06 macharborguy

actually, i found the issue. ['pc'] and [minecraftVersion] have to be swapped, so...

var versionInfo = minecraft_data.versionsByMinecraftVersion["pc"][minecraftVersion];

Instead of...

var versionInfo = minecraft_data.versionsByMinecraftVersion[minecraftVersion]["pc"];

The problem now is that the bot connects to the server, minecraft-protocol-forge auto-detects the mods the server is using...

Using forgeMods: [array of mods the server is using]

... but then no packets are received, or raw events, until the connection simply drops. As before, the bot account name appears when the connection is lost (bot left the game), but never is shown joining nor appears in the user list.

The "err" object returned to the "end" event when the connection is lost is 'undefined'

Also, here is the server launch string if it will help...

Server Launch String : /usr/bin/java -server -Xms512M -Xmx6G -XX:PermSize=1G -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000 -XX:ParallelGCThreads=10 -jar FTBServer-1.7.10-1614.jar nogui

macharborguy avatar Jun 30 '16 14:06 macharborguy

I'll take a closer look later but in the meantime, maybe @deathcap would be able to help about forge

rom1504 avatar Jun 30 '16 14:06 rom1504