Coder Social home page Coder Social logo

node-minecraft-protocol-forge's Introduction

minecraft-protocol-forge

NPM version Join the chat at https://gitter.im/PrismarineJS/node-minecraft-protocol

Adds FML/Forge support to node-minecraft-protocol (requires 0.17+)

Features

  • Supports the FML|HS client handshake
  • Adds automatic Forge mod detection to node-minecraft-protocol's auto-versioning

Usage

Installable as a plugin for use with node-minecraft-protocol:

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' }
]});

The forgeMods option is an array of modification identifiers and versions to present to the server. Servers will kick the client if they do not have the required mods.

To automatically present the list of mods offered by the server, the autoVersionForge plugin for node-minecraft-protocol's autoVersion (activated by version: false) can be used:

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);

This will automatically install the forgeHandshake plugin, with the appropriate mods, if the server advertises itself as Forge/FML. Useful for connecting to servers you don't know if they are Forge or not, or what mods they are using.

Installation

npm install minecraft-protocol-forge

Debugging

You can enable some protocol debugging output using NODE_DEBUG environment variable:

NODE_DEBUG="minecraft-protocol-forge" node [...]

node-minecraft-protocol-forge's People

Contributors

danielpmc avatar deathcap avatar dependabot-preview[bot] avatar murilopereirame avatar mykola1453 avatar rob9315 avatar rom1504 avatar rom1504bot avatar wondermine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-minecraft-protocol-forge's Issues

Disconnecting VANILLA connection attempt...

Code in JS is:

const usr = process.env.USERNAME;
const pwd = process.env.PASSWORD;
var mc = require('minecraft-protocol');
var autoVersionForge = require('minecraft-protocol-forge').autoVersionForge;
var client = mc.createClient({
    version: '1.15.2',
    host: 'myserver.ip', 
    port: 37390,
    username: usr,
    password: pwd
});
 
autoVersionForge(client);

The server is forge 1.15.2

Disconnecting VANILLA connection attempt... was in console of server

Parse all fields of the RegistryData (1.8+) or ModIdData (1.7-) packets

              "RegistryData":
              [
                "container",
                [
                  {
                    "name": "hasMore",
                    "type": "bool"
                  },

                  /* TODO: support all fields
                  {
                    "name": "registryName",
                    "type": "string"
                  },
                  */
                ],
              ],

RegistryData is only parsed for the hasMore bool, to know when the last packet was received. http://wiki.vg/Minecraft_Forge_Handshake#RegistryData documents the full structure. Includes registry name, string to id mapping, and array of substitutions. Should parse this because it might be useful for client applications.

npm package outdated

Hello, I've done some test on a 1.16.5 Forge Minecraft server.

After some trials and errors, I checked the files between the package and the repo GitHub.
The package is outdated of 6 years (package version : 1.0.0 | release date of the version : 13 feb 2016)
It couldn't work for +1.13 Forge Minecraft servers cause it's outdated.

Could you do an update of the package and test it ?

mod list is now Encrypted | Encoded with special technique.

I will just leave this issue here.

When you try to get the packet for the server_info. You will find some unfimiliar characters and some weird patterns. The normal packet is there, but an additional key is added, "d". And that key contains unknown binary information.

After some digging, it appears that the newer forge versions encrypt mod lists to avoid packet limit issues. which ends up breaking autoVersionForge. I've been trying to decrypt this data but with no success.

mineflayer will be able to join if mods are able to be played with vanilla, but game-changing mods will just break the bot. and the bot will assume no mods are present.

Example

{
  'forgeData': {
    'channels': [],
    'mods': [],
    'truncated': False,
    'fmlNetworkVersion': 3,
    'd': 'Ñ\x00\x00ࠌ㐤獋㙖⹌ᦘ̺⸱恤䒸⡑⛧沮婙㨹牥ఈㄵচ₀沮婙㨹牥ఈㄵচ䀀⺁Კス汢峊ᖑ䮓挰䘅ఋᢗ㔶ਈ㶘㮓㙖䠠ᙓ㨆敩㻤㷍⎓暗泭ీ᠗Ԁ惦▱ᮣ挐☥䂀や敬曰㶵ᬓၧ䗆ಌ᪗洌勂綹䌚昖ⷍ嬙ᢀ\x00䐚㶥⭫ญᥛ㨷\u0a79灢䂸ű勣䜦䂌ㆃ瑩䣂㆕ါ䋣䗆䌌ザ湩䚾֡獳䙖\u202d\x0c'
  },
  'description': {
    'text': 'A Minecraft Server'
  },
  'players': {
    'max': 20,
    'online': 0},
    'version': {
      'name': '1.20.1',
      'protocol': 763
    }
}

Error while login

connected
Using forgeMods2: [
{ modId: 'rhino', modmarker: '1605.1.5-build.75' },
{ modId: 'cgm', modmarker: '1.2.6' },
{ modId: 'flatbedrock', modmarker: '1.2.0-build.2+mc1.16.5' },
{ modId: 'eidolon', modmarker: '0.2.7' },
{ modId: 'jei', modmarker: '7.8.0.1009' },
{ modId: 'abnormals_core', modmarker: '3.3.1' },
{ modId: 'doggytalents', modmarker: '2.1.15' },
{ modId: 'goblintraders', modmarker: '1.7.3' },
{ modId: 'projecte', modmarker: 'PE1.0.2' },
{ modId: 'upgrade_aquatic', modmarker: '3.1.2' },
{ modId: 'waystones', modmarker: '7.6.4' },
{ modId: 'ctm', modmarker: 'MC1.16.1-1.1.2.6' },
{ modId: 'xaeroworldmap', modmarker: '1.34.1' },
{ modId: 'placebo', modmarker: '4.7.1' },
{ modId: 'artifacts', modmarker: '1.16.5-2.10.5' },
{ modId: 'naturescompass', modmarker: '1.16.5-1.9.1-forge' },
{
modId: 'configured',
modmarker: 'OHNOES😱😱😱😱😱😱😱😱😱😱😱😱😱😱😱😱😱'
},
{ modId: 'additionalguns', modmarker: '0.8.0' },
{ modId: 'champions', modmarker: '1.16.5-2.0.1.16' },
{ modId: 'dungeoncrawl', modmarker: '2.3.12' },
{ modId: 'bookshelf', modmarker: '10.4.33' },
{ modId: 'xreliquary', modmarker: '1.16.5-1.3.5.1124' },
{ modId: 'endergetic', modmarker: '3.0.2' },
{ modId: 'sophisticatedbackpacks', modmarker: '1.16.5-3.15.20.755' },
{ modId: 'relics', modmarker: '0.3.4.4' },
{ modId: 'apotheosis', modmarker: '4.8.9A0' },
{ modId: 'explorerscompass', modmarker: '1.16.5-1.1.2-forge' },
{ modId: 'waila', modmarker: '1.10.11-B78_1.16.2' },
{ modId: 'jeresources', modmarker: '0.12.2.216' },
{ modId: 'paraglider', modmarker: '1.3.2.14' },
{ modId: 'forge', modmarker: 'ANY' },
{ modId: 'dummmmmmy', modmarker: '1.3.0' },
{ modId: 'upgradednetherite', modmarker: '1.16.5-2.1.0.1-release' },
{ modId: 'corpse', modmarker: '1.16.5-1.0.7' },
{ modId: 'selene', modmarker: '1.16.5-1.0' },
{ modId: 'chipped', modmarker: '1.16.5-1.2.1-forge' },
{ modId: 'dungeons_arise', modmarker: '2.1.49' },
{ modId: 'farmersdelight', modmarker: '1.16.5-0.6.0' },
{ modId: 'minecraft', modmarker: '1.16.5' },
{ modId: 'enchdesc', modmarker: '7.1.23' },
{ modId: 'ironfurnaces', modmarker: '2.7.7' },
{ modId: 'vehicle', modmarker: '0.45.2' },
{ modId: 'born_in_chaos_v1', modmarker: '1.0.0' },
{ modId: 'curios', modmarker: '1.16.5-4.1.0.0' },
{ modId: 'quark', modmarker: 'r2.4-322' },
{ modId: 'patchouli', modmarker: '1.16.4-53.3' },
{ modId: 'spartanshields', modmarker: '2.1.2' },
{ modId: 'xaerominimap', modmarker: '23.8.2' },
{ modId: 'securitycraft', modmarker: 'v1.9.7.1' },
{ modId: 'autoreglib', modmarker: '1.6-49' },
{ modId: 'oreexcavation', modmarker: '1.8.157' },
{ modId: 'storagedrawers', modmarker: '8.5.2' },
{ modId: 'elevatorid', modmarker: '1.16.5-1.7.13' },
{ modId: 'obfuscate', modmarker: '0.6.3' },
{ modId: 'upgradedcore', modmarker: '1.16.5-1.1.0.3-release' },
{ modId: 'constructionwand', modmarker: '1.16.5-2.6' },
{ modId: 'morevanillaarmor', modmarker: '1.16.4-1.2.6' },
{ modId: 'spartanweaponry', modmarker: '2.2.0 Release Candidate 2' },
{ modId: 'appleskin', modmarker: '2.5.1+mc1.16.4' },
{ modId: 'architectury', modmarker: '1.32.68' },
{ modId: 'nethers_delight', modmarker: '2.1' },
{
modId: 'upgradednetherite_ultimate',
modmarker: '1.16.5-1.1.0.3-release'
},
{
modId: 'upgradednetherite_spartan',
modmarker: '1.16.5-1.0.0.2-beta'
},
{ modId: 'cosmeticarmorreworked', modmarker: '1.16.5-v5' },
{ modId: 'expandability', modmarker: '2.0.1' },
{ modId: 'geckolib3', modmarker: '3.0.106' },
{ modId: 'cyclic', modmarker: '1.16.5-1.5.21' }
]
other loginwrapperchannel obfuscate:handshake received
other loginwrapperchannel cgm:handshake received
disconnected: {"translate":"multiplayer.disconnect.slow_login"}
Connection lost

I am using the normal example file

expected RegistryData in WAITINGSERVERCOMPLETE, got HandshakeAck

Hello, I tried to connect to a 1.7.10 forge server but my program keeps failing...

My code is:

const client = mc.createClient({
	version: "1.7.10",
	host: "localhost",
	port: 25565,
	username: "xxxxxxxxxxx",
	auth: "microsoft",
});

mfp.forgeHandshake(client, {
	forgeMods: [
		{ modid: "mcp", version: "9.05" },
		{ modid: "FML", version: "7.10.99.99" },
		{ modid: "Forge", version: "10.13.4.1614" },
		{ modid: "IronChest", version: "6.0.62.742" },
	],
});

The program logs:

MC-PROTO-FORGE: 26358 FML|HS {
  data: {
    discriminator: 'ServerHello',
    fmlProtocolVersion: 2,
    overrideDimension: 1
  },
  metadata: { size: 6 },
  buffer: <Buffer 00 02 00 00 00 01>
}
MC-PROTO-FORGE: 26358 Sending client modlist
MC-PROTO-FORGE: 26358 FML|HS {
  data: {
    discriminator: 'ModList',
    mods: [ [Object], [Object], [Object], [Object] ]
  },
  metadata: { size: 66 },
  buffer: <Buffer 02 04 03 46 4d 4c 0a 37 2e 31 30 2e 39 39 2e 39 39 05 46 6f 72 67 65 0c 31 30 2e 31 33 2e 34 2e 31 36 31 34 09 49 72 6f 6e 43 68 65 73 74 0a 36 2e 30 ... 16 more bytes>
}
MC-PROTO-FORGE: 26358 Server ModList: [
  { modid: 'FML', version: '7.10.99.99' },
  { modid: 'Forge', version: '10.13.4.1614' },
  { modid: 'IronChest', version: '6.0.62.742' },
  { modid: 'mcp', version: '9.05' }
]
MC-PROTO-FORGE: 26358 FML|HS {
  data: { discriminator: 'RegistryData', hasMore: true },
  metadata: { size: 2 },
  buffer: <Buffer 03 f1 03 10 01 6d 69 6e 65 63 72 61 66 74 3a 67 6c 61 73 73 14 17 01 6d 69 6e 65 63 72 61 66 74 3a 73 74 6f 6e 65 5f 73 74 61 69 72 73 43 11 02 6d 69 ... 11924 more bytes>
}
MC-PROTO-FORGE: 26358 RegistryData { discriminator: 'RegistryData', hasMore: true }
MC-PROTO-FORGE: 26358 FML|HS {
  data: { discriminator: 'HandshakeAck', phase: 2 },
  metadata: { size: 2 },
  buffer: <Buffer ff 02>
}
/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/minecraft-protocol/src/transforms/framing.js:67
          } else { throw e }
                   ^

AssertionError [ERR_ASSERTION]: expected RegistryData in WAITINGSERVERCOMPLETE, got HandshakeAck
    at fmlHandshakeStep (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/minecraft-protocol-forge/src/client/forgeHandshake.js:231:14)
    at Client.<anonymous> (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/minecraft-protocol-forge/src/client/forgeHandshake.js:271:7)
    at Client.emit (node:events:402:35)
    at FullPacketParser.<anonymous> (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/minecraft-protocol/src/client.js:91:12)
    at FullPacketParser.emit (node:events:390:28)
    at addChunk (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/readable-stream/lib/_stream_readable.js:298:12)
    at readableAddChunk (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/readable-stream/lib/_stream_readable.js:280:11)
    at FullPacketParser.Readable.push (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/readable-stream/lib/_stream_readable.js:241:10)
    at FullPacketParser.Transform.push (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/readable-stream/lib/_stream_transform.js:139:32)
    at FullPacketParser._transform (/home/burn/Documents/Projects/forge-minecraft-protocol/node_modules/protodef/src/serializer.js:89:10) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

And the server logs:

[20:41:40] [User Authenticator #1/INFO]: UUID of player BurnGemios3643 is f9c28e04-3a04-4e9f-9244-fd378d808d7a
[20:41:41] [Netty IO #1/INFO] [FML]: Client protocol version 2
[20:41:41] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : [email protected],[email protected],[email protected],[email protected]
[20:41:41] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT
[20:41:41] [Netty IO #1/ERROR] [FML]: NetworkDispatcher exception
java.io.IOException: Connection reset by peer
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:1.8.0_292]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:1.8.0_292]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:1.8.0_292]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) ~[?:1.8.0_292]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379) ~[?:1.8.0_292]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:436) ~[UnpooledUnsafeDirectByteBuf.class:?]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:870) ~[AbstractByteBuf.class:?]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:208) ~[NioSocketChannel.class:?]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:87) [AbstractNioByteChannel$NioByteUnsafe.class:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480) [NioEventLoop.class:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [NioEventLoop.class:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [NioEventLoop.class:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
[20:41:41] [Server thread/INFO]: BurnGemios3643 lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}
[20:41:41] [Server thread/INFO]: BurnGemios3643 left the game

An idea on what make him crash? thx

-

So, i was coding a proxy, that allows you to join a server (e.g.: Hypixel) with another account, without having to relaunch the game. But, if i join the proxy, i get connected to the target server, but, for me, i don't have a skin. Other players can see me just fine, but i myself can't. Is this even possible? Here is my code, if that helps:

var mc = require( 'minecraft-protocol');
var server = mc.createServer({
	'keepAlive': false,
	'max-players': 1,
	'motd': 'Proxy-Test',
	'version': '1.8.8',
	'online-mode': true,
	'port': '25576'
});


server.on('login', client => {
		const remote = mc.createClient({
			keepAlive: false,
			host: 'myserver.net',
			port: '25565',
			username: "[email protected]",
			password: "password!",
			version: '1.8.8'
		});


		[remote, client].forEach((value, index, array) => {
			const opposite = array[index === 0 ? 1 : 0];
			value
				.on('end', () => opposite.end('Disconnected'))
				.on('raw', (buffer, metadata) => {
					if (metadata.state === 'play') opposite.writeRaw(buffer);
				});
		});
		
		}
	});
console.log('Started proxy on port '+server.port);

Any help is appreciated! I just can't figure this out for my life.

Kind regards,
Tuxorials

Using on replit

I couldn't manage to use it from replit for my aternos server. Can anyone help about it?

Outdated dependencies in package.json files (examples folder)

@rom1504, happy holidays!

I've noticed today that package.json files in the examples folder require as dependency an ancient version of minecraft-protocol (^0.20.3). The way it is now, running npm install from each example folder will result in error.

Instead, in client_forge folder, the package.json file should require just minecraft-protocol-forge:

  "dependencies": {
    "minecraft-protocol-forge": "file:../../"
  },

(It also needs minecraft-protocol and protodef, but these packages are already required by minecraft-protocol-forge).

In mineflayer_forge folder:

  "dependencies": {
    "minecraft-protocol-forge": "file:../../",
    "mineflayer": "^4.17.0",
    "mineflayer-pathfinder": "^2.4.5"
  },

And in mineflayer_forge_simplelogin folder:

  "dependencies": {
    "minecraft-protocol-forge": "file:../../",
    "mineflayer": "^4.17.0",
    "mineflayer-pathfinder": "^2.4.5",
    "crypto-js": "^4.2.0"
  },

Now examples work after I run npm install in the root folder of the repo, and then again in the example folder I want to use. I'd open PR if needed, but I hardly know anything about npm and package.json, so wanted to ask your opinion before doing anything.

Error with mineflayer "Chunk size is 129 but only 1 was read ; partial packet "

const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
    host: IP, // minecraft server ip
    username: 'Trolololo',
    //password: '12345678' // minecraft password, comment out if you want to log into online-mode=false servers
    port: 25566,
    version: "1.18.2",
    // auth: 'mojang'              // only set if you need microsoft auth, then set this to 'microsoft'
})

var forgeHandshake = require('minecraft-protocol-forge').forgeHandshake
forgeHandshake(bot._client, {
    forgeMods: [
        { modid: 'feature_nbt_deadlock_be_gone', version: '2.0.0+1.18.2' },
        { modid: 'create', version: '0.4.1' },
        { modid: 'citadel', version: '1.11.3' },
        { modid: 'autoreglib', version: '1.7-53' },
        { modid: 'alexsmobs', version: '1.18.3' },
        { modid: 'flywheel', version: '1.18-0.6.2' },
        { modid: 'idas', version: '1.1.3+1.18.2' },
        { modid: 'quark', version: '3.2-356' },
        { modid: 'xaeroworldmap', version: '1.20.3.1' }
    ]
})

bot.on('chat', (username, message) => {
    if (username === bot.username) return
    bot.chat(message)
})

// Log errors and kick reasons:
bot.on('kicked', console.log)
bot.on('error', console.log)

Chunk size is 129 but only 1 was read ; partial packet : {"name":26}; buffer :1a7f7b227472616e736c617465223a22646973636f6e6e6563742e67656e65726963526561736f6e222c2277697468223a5b22496e7465726e616c20457863657074696f6e3a206a6176612e6c616e672e4e756d626572466f726d6174457863657074696f6e3a20466f7220696e70757420737472696e673a205c225c22225d7d

How to setting a Forge 1.20.1 47.2.19 bot? #forge

Hey everyone i have a problem to get mod list from my server forge.

NODE_DEBUG = "minecraft-protocol-forge";

const autoVersionForge = require("minecraft-protocol-forge/src/client/autoVersionForge");
const mineflayer = require("mineflayer");
const pathfinder = require("mineflayer-pathfinder");

const bot = mineflayer.createBot({
  version: false,
  host: "ip",
  port: "port",
  username: "",
  password: "",
});

// leave options empty for guessing, otherwise specify the mods,
// channels and registries manually (channels and registries are only
// relevant for fml2 handshake)
const options = {
  forgeMods: undefined,
  channels: undefined,
};

// add handler
autoVersionForge(bot._client, options);
console.log(options);

bot.loadPlugin(pathfinder.pathfinder);
console.info("Started mineflayer");

// set up logging
bot.on("connect", function () {
  console.info("connected");
});

bot.on("spawn", function () {
  console.info("I spawned");
});

it is a start example from repo here. This code send a request to my server but server get a Vanilia type of user. [Netty Epoll Server IO #4/ERROR] [ne.mi.ne.NetworkRegistry/NETREGISTRY]: Channels [simpleplanes:main,spawn:network,aether:main,citadel:main_channel,nitrogen_internals:main,epicfight:network_manager,curios:main,geckolib:main] rejected vanilla connections. Disconnecting VANILLA connection attempt: This server has mods that require Forge to be installed on the client. Contact your server admin for more details.

Anyone can help me with this problem?

Add tests using official Forge server

Currently nmp-f has no tests, but it should, like nmp - setting up a test server, connecting to it, etc. Check into using minecraft-wrap, perhaps augment or enhance it to support installing Forge servers (http://files.minecraftforge.net) and mods: (good mod to start with is IronChests: http://files.minecraftforge.net/maven/cpw/mods/ironchest/)

  • Install vanilla server
  • Install Forge onto vanilla server
  • Install a mod onto Forge server
  • Connect with forgeHandshake and explicit mod list, confirm able to login
  • Connect and test autoForgeVersion negotiation, confirm able to login

[1.7] varshort for node-minecraft-protocol-forge

http://wiki.vg/Minecraft_Forge_Handshake#Definitions

Minecraft Forge uses an additional type not covered in data types for some things -- a varshort. This is essentially the same as a regular short, except that if the top byte (what is normally sign) is set, it is followed by an additional byte. This allows forge to retain backwards compatibility but extend the length of certain numbers -- the varshort is only used in places where, in vanilla Minecraft, the sign bit would not have been set. It is implemented in ByteBufUtils.

http://wiki.vg/Minecraft_Forge_Handshake#Differences_from_Forge_1.7.10

Forge for Minecraft 1.8 made some changes from the 1.7.10 version.
The most important thing to keep track of isn't (entirely) a forge change. In 1.7.10, plugin channel packets are length prefixed, while in 1.8 they are not. However, forge makes some more changes to the server to client packet (but not the client to server packet): Rather than using a short for the length, a varshort is used. Due to the way that varshorts work, this is backwards compatible, but if this is not accounted for you may receive forge packets that seem corrupted as there is an extra byte that appears seemingly randomly.
Warning: While it may seem like you can get away with not handling varshorts, on servers with lots of mods (EG FTB), this will appear.

http://wiki.vg/Minecraft_Forge_Handshake#Definitions

https://github.com/MinecraftForge/MinecraftForge/blob/ebe9b6d4cbc4a5281c386994f1fbda04df5d2e1f/src/main/java/net/minecraftforge/fml/common/network/ByteBufUtils.java#L58-L89

FTB Infinity Evolved Server (latest version), 1.7.10 MC version

Im having trouble getting connected to my MC FTB Infinity Evolved server. It gets the initial handshake, gets the list of mods, fires the "connected" event, then delays for about 5-10 seconds and loses the connection, with the err object returning as Undefined.

I am using the client example with the only change being my login information, server address and port.

Here is the mods that the script outputs to the console upon initial connection, if that will help. The script outputs no errors or stack traces.

From within the server, the only proof that the client connected is that upon Connection Lost, "botname left the server" appears in chat. The bot is never reported as having joined, nor appears in the user list.

This is a very basic, cut and dry FTB Infinity Evolved install with no changes other than making Elevator blocks work at longer distances.

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

Using forgeMods: [ { modid: 'mcp', version: '9.05' },
  { modid: 'FML', version: '7.10.99.99' },
  { modid: 'Forge', version: '10.13.4.1614' },
  { modid: 'appliedenergistics2-core', version: 'rv3-beta-5' },
  { modid: 'CodeChickenCore', version: '1.0.7.47' },
  { modid: 'NotEnoughItems', version: '1.0.5.118' },
  { modid: 'ThE-core', version: '0.10.0.0' },
  { modid: 'ThaumicTinkerer-preloader', version: '0.1' },
  { modid: 'ChocoPatcher', version: '1.1' },
  { modid: 'OpenModsCore', version: '0.9.1' },
  { modid: '<CoFH ASM>', version: '000' },
  { modid: 'BinniePatcher', version: '1.7.1' },
  { modid: 'FastCraft', version: '1.23' },
  { modid: 'debug', version: '1.0' },
  { modid: 'IC2', version: '2.2.819-experimental' },
  { modid: 'AdvancedSolarPanel', version: '1.7.10-3.5.1' },
  { modid: 'AgriCraft', version: '1.7.10-1.5.0' },
  { modid: 'appliedenergistics2', version: 'rv3-beta-5' },
  { modid: 'AWWayofTime', version: 'v1.3.3' },
  { modid: 'Baubles', version: '1.0.1.10' },
  { modid: 'Thaumcraft', version: '4.2.3.5' },
  { modid: 'Botania', version: 'r1.8-249' },
  { modid: 'Avaritia', version: '1.11' },
  { modid: 'bdlib', version: '1.9.4.109' },
  { modid: 'BiblioCraft', version: '1.11.4' },
  { modid: 'Mantle', version: '1.7.10-0.3.2.jenkins191' },
  { modid: 'Natura', version: '2.2.0' },
  { modid: 'BiomesOPlenty', version: '2.1.0' },
  { modid: 'BiblioWoodsBoP', version: '1.9' },
  { modid: 'CoFHCore', version: '1.7.10R3.1.2' },
  { modid: 'Forestry', version: '4.2.11.59' },
  { modid: 'BiblioWoodsForestry', version: '1.7' },
  { modid: 'BiblioWoodsNatura', version: '1.5' },
  { modid: 'ThermalFoundation', version: '1.7.10R1.2.3' },
  { modid: 'ThermalExpansion', version: '1.7.10R4.1.2' },
  { modid: 'BigReactors', version: '0.4.3A' },
  { modid: 'BinnieCore', version: '2.0-pre14' },
  { modid: 'Botany', version: '2.0-pre14' },
  { modid: 'ExtraBees', version: '2.0-pre14' },
  { modid: 'ExtraTrees', version: '2.0-pre14' },
  { modid: 'Genetics', version: '2.0-pre14' },
  { modid: 'BrandonsCore', version: '1.0.0.12' },
  { modid: 'BuildCraft|Core', version: '7.1.16' },
  { modid: 'BuildCraft|Builders', version: '7.1.16' },
  { modid: 'BuildCraft|Transport', version: '7.1.16' },
  { modid: 'BuildCraft|Energy', version: '7.1.16' },
  { modid: 'BuildCraft|Silicon', version: '7.1.16' },
  { modid: 'BuildCraft|Robotics', version: '7.1.16' },
  { modid: 'BuildCraft|Factory', version: '7.1.16' },
  { modid: 'BuildCraft|Compat', version: '7.1.3' },
  { modid: 'CarpentersBlocks', version: '3.3.7' },
  { modid: 'Railcraft', version: '9.10.0.0' },
  { modid: 'TwilightForest', version: '2.3.7' },
  { modid: 'ForgeMultipart', version: '1.2.0.345' },
  { modid: 'chisel', version: '2.9.5.11' },
  { modid: 'ComputerCraft', version: '1.75' },
  { modid: 'PTRModelLib', version: '1.0.0' },
  { modid: 'props', version: '2.2.1' },
  { modid: 'DraconicEvolution', version: '1.0.2a' },
  { modid: 'endercore', version: '1.7.10-0.2.0.32_beta' },
  { modid: 'MineFactoryReloaded', version: '1.7.10R2.8.1' },
  { modid: 'Waila', version: '1.5.10' },
  { modid: 'EnderIO', version: '1.7.10-2.3.0.424_beta' },
  { modid: 'EnderStorage', version: '1.4.7.37' },
  { modid: 'EnderTech', version: '1.7.10-0.3.2.405' },
  { modid: 'EnderZoo', version: '1.7.10-1.0.15.32' },
  { modid: 'extracells', version: '2.3.9' },
  { modid: 'ExtraUtilities', version: '1.2.12' },
  { modid: 'harvestcraft', version: '1.7.10j' },
  { modid: 'ImmersiveEngineering', version: '0.7.5' },
  { modid: 'TConstruct', version: '1.7.10-1.8.8.build988' },
  { modid: 'ExtraTiC', version: '1.4.5' },
  { modid: 'fastleafdecay', version: '1.4' },
  { modid: 'ThaumicTinkerer', version: 'unspecified' },
  { modid: 'ForbiddenMagic', version: '1.7.10-0.574' },
  { modid: 'ForgeIRC', version: '1.2.9' },
  { modid: 'MineTweaker3', version: '3.0.10' },
  { modid: 'FTBL', version: '1.0.17.6' },
  { modid: 'FTBT', version: '1.0.1' },
  { modid: 'FTBU', version: '1.0.17.6' },
  { modid: 'funkylocomotion', version: '1.0' },
  { modid: 'RedstoneArsenal', version: '1.7.10R1.1.2' },
  { modid: 'MagicBees', version: '2.4.3' },
  { modid: 'gendustry', version: '1.6.3.132' },
  { modid: 'GraviSuite', version: '1.7.10-2.0.3' },
  { modid: 'guideapi', version: '1.7.10-1.0.1-20' },
  { modid: 'iChunUtil', version: '4.2.2' },
  { modid: 'Hats', version: '4.0.1' },
  { modid: 'HatStand', version: '4.0.0' },
  { modid: 'headcrumbs', version: '1.7.4' },
  { modid: 'IC2NuclearControl', version: '2.3.4a' },
  { modid: 'immersiveintegration', version: '0.6.8' },
  { modid: 'inpure|core', version: '1.7.10R1.0.0B9' },
  { modid: 'inventorytweaks', version: '1.59-dev-152-cf6e263' },
  { modid: 'IronChest', version: '6.0.62.742' },
  { modid: 'JABBA', version: '1.2.1' },
  { modid: 'journeymap', version: '5.1.4' },
  { modid: 'LogisticsPipes', version: '0.9.3.114' },
  { modid: 'MineFactoryReloaded|CompatAppliedEnergistics',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatBuildCraft',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatForestry',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatForgeMicroblock',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatIC2',
    version: '1.7.10R2.8.1' },
  { modid: 'MrTJPCoreMod', version: '1.1.0.33' },
  { modid: 'ProjRed|Core', version: '4.7.0pre12.95' },
  { modid: 'ProjRed|Exploration', version: '4.7.0pre12.95' },
  { modid: 'MineFactoryReloaded|CompatProjRed',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatRailcraft',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatThaumcraft',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatThermalExpansion',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatTConstruct',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatTwilightForest',
    version: '1.7.10R2.8.1' },
  { modid: 'MineFactoryReloaded|CompatVanilla',
    version: '1.7.10R2.8.1' },
  { modid: 'modtweaker2', version: '0.9.5' },
  { modid: 'Morpheus', version: '1.7.10-1.6.21' },
  { modid: 'Mystcraft', version: '0.12.3.01' },
  { modid: 'NEIAddons', version: '1.12.14.40' },
  { modid: 'NEIAddons|Developer', version: '1.12.14.40' },
  { modid: 'NEIAddons|AppEng', version: '1.12.14.40' },
  { modid: 'NEIAddons|Botany', version: '1.12.14.40' },
  { modid: 'NEIAddons|Forestry', version: '1.12.14.40' },
  { modid: 'NEIAddons|CraftingTables', version: '1.12.14.40' },
  { modid: 'NEIAddons|ExNihilo', version: '1.12.14.40' },
  { modid: 'neiintegration', version: '1.1.2' },
  { modid: 'NetherOres', version: '1.7.10R2.3.1' },
  { modid: 'neresources', version: '0.1.0.ManuallyBuilt' },
  { modid: 'OpenMods', version: '0.9.1' },
  { modid: 'OpenBlocks', version: '1.5.1' },
  { modid: 'OpenPeripheralCore', version: '1.3' },
  { modid: 'OpenPeripheral', version: '0.5.1' },
  { modid: 'OpenPeripheralIntegration', version: '0.5' },
  { modid: 'PortalGun', version: '4.0.0-beta-6' },
  { modid: 'ProjRed|Transmission', version: '4.7.0pre12.95' },
  { modid: 'ProjRed|Transportation', version: '4.7.0pre12.95' },
  { modid: 'ProjRed|Compatibility', version: '4.7.0pre12.95' },
  { modid: 'ProjRed|Integration', version: '4.7.0pre12.95' },
  { modid: 'ProjRed|Illumination', version: '4.7.0pre12.95' },
  { modid: 'ProjRed|Expansion', version: '4.7.0pre12.95' },
  { modid: 'rftools', version: '4.23' },
  { modid: 'runicdungeons', version: '1.1.6a' },
  { modid: 'simplyjetpacks', version: '1.5.3' },
  { modid: 'SolarExpansion', version: '1.6a' },
  { modid: 'springboards', version: '0.1' },
  { modid: 'StevesFactoryManager', version: 'A93' },
  { modid: 'StevesAddons', version: '0.10.16' },
  { modid: 'StevesCarts', version: '2.0.0.b18' },
  { modid: 'StevesWorkshop', version: '0.5.1' },
  { modid: 'StorageDrawers', version: '1.7.10-1.9.7' },
  { modid: 'StorageDrawersBop', version: '1.7.10-1.1.1' },
  { modid: 'StorageDrawersForestry', version: '1.7.10-1.1.2' },
  { modid: 'StorageDrawersMisc', version: '1.7.10-1.1.2' },
  { modid: 'StorageDrawersNatura', version: '1.7.10-1.1.1' },
  { modid: 'tcinventoryscan', version: '1.0.11' },
  { modid: 'thaumcraftneiplugin', version: '@VERSION@' },
  { modid: 'thaumicenergistics', version: '1.0.0.1' },
  { modid: 'ThaumicExploration', version: '0.6.0' },
  { modid: 'ThermalDynamics', version: '1.7.10R1.1.0' },
  { modid: 'TiCTooltips', version: '1.2.5' },
  { modid: 'TMechworks', version: '0.2.15.106' },
  { modid: 'Translocator', version: '1.1.2.15' },
  { modid: 'WailaHarvestability', version: '1.1.6' },
  { modid: 'wawla', version: '1.3.3' },
  { modid: 'witchery', version: '0.24.1' },
  { modid: 'WR-CBE|Core', version: '1.4.1.9' },
  { modid: 'WR-CBE|Addons', version: '1.4.1.9' },
  { modid: 'WR-CBE|Logic', version: '1.4.1.9' },
  { modid: 'McMultipart', version: '1.2.0.345' },
  { modid: 'ForgeRelocation', version: '0.0.1.4' },
  { modid: 'MCFrames', version: '1.0' },
  { modid: 'RelocationFMP', version: '0.0.1.2' },
  { modid: 'aobd', version: '2.9.1' },
  { modid: 'denseores', version: '1.0' },
  { modid: 'ForgeMicroblock', version: '1.2.0.345' } ]

Doesn't work with latest version of node-minecraft-protocol

Hi, hopefully this isn't 100% dead, and I will be looking into it myself... but anyways. Trying to run this in 1.12.2 and it seems like this is working with the latest version of nmp, or it's the version bump that killed it.

Here's debug logs from nmp:

registered forge
  minecraft-protocol writing packet handshaking.set_protocol +0ms
  minecraft-protocol {
  minecraft-protocol   protocolVersion: 340,
  minecraft-protocol   serverHost: 'minecraft.tritonjs.com',
  minecraft-protocol   serverPort: 25565,
  minecraft-protocol   nextState: 2
  minecraft-protocol } +1ms
  minecraft-protocol writing packet login.login_start +5ms
  minecraft-protocol { username: 'RainbowDashDC' } +0ms
{"level":30,"time":1573278813022,"pid":13021,"hostname":"naofumi.local","name":"index.js","msg":"connected","v":1}
  minecraft-protocol read packet login.disconnect +3ms
  minecraft-protocol {
  minecraft-protocol   "reason": "{\"text\":\"This server has mods that require FML/Forge to be installed on the client. Contact your server admin for more details.\"}"
  minecraft-protocol } +0ms

It seems like it's not getting to the autoVersionHook stage, which I think means forge needs validation at some other step now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.