New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

minecraft-protocol

Package Overview
Dependencies
Maintainers
7
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minecraft-protocol - npm Package Compare versions

Comparing version 1.16.0 to 1.17.0

3

docs/API.md

@@ -10,3 +10,4 @@ # Documentation

* port : default to 25565
* host : default to localhost
* host : default to undefined which means listen to all available ipv4 and ipv6 adresses
(see https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback for details)
* kickTimeout : default to `10*1000` (10s), kick client that doesn't answer to keepalive after that time

@@ -13,0 +14,0 @@ * checkTimeoutInterval : default to `4*1000` (4s), send keepalive packet at that period

# History
## 1.17.0
* minecraft 1.16.2 and 1.16.3 support
## 1.16.0

@@ -4,0 +8,0 @@

@@ -16,3 +16,3 @@ # minecraft protocol

1.10 (16w20a, 1.10-pre1, 1.10, 1.10.1, 1.10.2), 1.11 (16w35a, 1.11, 1.11.2), 1.12 (17w15a, 17w18b, 1.12-pre4, 1.12, 1.12.1, 1.12.2), and 1.13 (17w50a, 1.13, 1.13.1, 1.13.2-pre1, 1.13.2-pre2, 1.13.2), 1.14 (1.14, 1.14.1, 1.14.3, 1.14.4)
, 1.15 (1.15, 1.15.1, 1.15.2) and 1.16 (20w13b, 20w14a, 1.16-rc1, 1.16, 1.16.1)
, 1.15 (1.15, 1.15.1, 1.15.2) and 1.16 (20w13b, 20w14a, 1.16-rc1, 1.16, 1.16.1, 1.16.2, 1.16.3)
* Parses all packets and emits events with packet fields as JavaScript

@@ -93,73 +93,26 @@ objects.

port: 25565, // optional
version: '1.16'
version: '1.16.3'
});
const mcData = require('minecraft-data')(server.version)
server.on('login', function(client) {
const w = {
piglin_safe: {
type: 'byte',
value: 0
},
natural: {
type: 'byte',
value: 1
},
ambient_light: {
type: 'float',
value: 0
},
infiniburn: {
type: 'string',
value: 'minecraft:infiniburn_overworld'
},
respawn_anchor_works: {
type: 'byte',
value: 0
},
has_skylight: {
type: 'byte',
value: 1
},
bed_works: {
type: 'byte',
value: 1
},
has_raids: {
type: 'byte',
value: 1
},
name: {
type: 'string',
value: 'minecraft:overworld'
},
logical_height: {
type: 'int',
value: 256
},
shrunk: {
type: 'byte',
value: 0
},
ultrawarm: {
type: 'byte',
value: 0
},
has_ceiling: {
type: 'byte',
value: 0
}
}
let loginPacket = mcData.loginPacket
client.write('login', {
entityId: client.id,
levelType: 'default',
isHardcore: false,
gameMode: 0,
previousGameMode: 255,
worldNames: ['minecraft:overworld'],
dimensionCodec: {name: '', type:'compound', value: {dimension: {type: 'list', value: {type: 'compound', value: [w]}}}},
dimension: 'minecraft:overworld',
worldNames: loginPacket.worldNames,
dimensionCodec: loginPacket.dimensionCodec,
dimension: loginPacket.dimension,
worldName: 'minecraft:overworld',
difficulty: 2,
hashedSeed: [0, 0],
maxPlayers: server.maxPlayers,
viewDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true
enableRespawnScreen: true,
isDebug: false,
isFlat: false
});

@@ -166,0 +119,0 @@ client.write('position', {

@@ -10,2 +10,4 @@ const mc = require('minecraft-protocol')

})
const mcData = require('minecraft-data')(server.version)
const loginPacket = mcData.loginPacket

@@ -15,70 +17,19 @@ server.on('login', function (client) {

client.on('MC|Brand', console.log)
const w = {
piglin_safe: {
type: 'byte',
value: 0
},
natural: {
type: 'byte',
value: 1
},
ambient_light: {
type: 'float',
value: 0
},
infiniburn: {
type: 'string',
value: 'minecraft:infiniburn_overworld'
},
respawn_anchor_works: {
type: 'byte',
value: 0
},
has_skylight: {
type: 'byte',
value: 1
},
bed_works: {
type: 'byte',
value: 1
},
has_raids: {
type: 'byte',
value: 1
},
name: {
type: 'string',
value: 'minecraft:overworld'
},
logical_height: {
type: 'int',
value: 256
},
shrunk: {
type: 'byte',
value: 0
},
ultrawarm: {
type: 'byte',
value: 0
},
has_ceiling: {
type: 'byte',
value: 0
}
}
client.write('login', {
entityId: client.id,
levelType: 'default',
isHardcore: false,
gameMode: 0,
previousGameMode: 255,
worldNames: ['minecraft:overworld'],
dimensionCodec: { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [{ name: w }] } } } },
dimension: 'minecraft:overworld',
worldNames: loginPacket.worldNames,
dimensionCodec: loginPacket.dimensionCodec,
dimension: loginPacket.dimension,
worldName: 'minecraft:overworld',
difficulty: 2,
hashedSeed: [0, 0],
maxPlayers: server.maxPlayers,
viewDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true,
hashedSeed: [0, 0]
isDebug: false,
isFlat: false
})

@@ -85,0 +36,0 @@ client.write('position', {

@@ -10,72 +10,22 @@ const mc = require('minecraft-protocol')

})
const mcData = require('minecraft-data')(server.version)
const loginPacket = mcData.loginPacket
server.on('login', function (client) {
const w = {
piglin_safe: {
type: 'byte',
value: 0
},
natural: {
type: 'byte',
value: 1
},
ambient_light: {
type: 'float',
value: 0
},
infiniburn: {
type: 'string',
value: 'minecraft:infiniburn_overworld'
},
respawn_anchor_works: {
type: 'byte',
value: 0
},
has_skylight: {
type: 'byte',
value: 1
},
bed_works: {
type: 'byte',
value: 1
},
has_raids: {
type: 'byte',
value: 1
},
name: {
type: 'string',
value: 'minecraft:overworld'
},
logical_height: {
type: 'int',
value: 256
},
shrunk: {
type: 'byte',
value: 0
},
ultrawarm: {
type: 'byte',
value: 0
},
has_ceiling: {
type: 'byte',
value: 0
}
}
client.write('login', {
entityId: client.id,
levelType: 'default',
isHardcore: false,
gameMode: 0,
previousGameMode: 255,
worldNames: ['minecraft:overworld'],
dimensionCodec: { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [w] } } } },
dimension: 'minecraft:overworld',
worldNames: loginPacket.worldNames,
dimensionCodec: loginPacket.dimensionCodec,
dimension: loginPacket.dimension,
worldName: 'minecraft:overworld',
difficulty: 2,
hashedSeed: [0, 0],
maxPlayers: server.maxPlayers,
viewDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true,
hashedSeed: [0, 0]
isDebug: false,
isFlat: false
})

@@ -82,0 +32,0 @@ client.registerChannel('CUSTOM|ChannelOne', ['i32', []], true)

@@ -9,2 +9,4 @@ const mc = require('minecraft-protocol')

const server = mc.createServer(options)
const mcData = require('minecraft-data')(server.version)
const loginPacket = mcData.loginPacket

@@ -23,72 +25,19 @@ server.on('login', function (client) {

const w = {
piglin_safe: {
type: 'byte',
value: 0
},
natural: {
type: 'byte',
value: 1
},
ambient_light: {
type: 'float',
value: 0
},
infiniburn: {
type: 'string',
value: 'minecraft:infiniburn_overworld'
},
respawn_anchor_works: {
type: 'byte',
value: 0
},
has_skylight: {
type: 'byte',
value: 1
},
bed_works: {
type: 'byte',
value: 1
},
has_raids: {
type: 'byte',
value: 1
},
name: {
type: 'string',
value: 'minecraft:overworld'
},
logical_height: {
type: 'int',
value: 256
},
shrunk: {
type: 'byte',
value: 0
},
ultrawarm: {
type: 'byte',
value: 0
},
has_ceiling: {
type: 'byte',
value: 0
}
}
// send init data so client will start rendering world
client.write('login', {
entityId: client.id,
levelType: 'default',
isHardcore: false,
gameMode: 0,
previousGameMode: 255,
worldNames: ['minecraft:overworld'],
dimensionCodec: { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [w] } } } },
dimension: 'minecraft:overworld',
worldNames: loginPacket.worldNames,
dimensionCodec: loginPacket.dimensionCodec,
dimension: loginPacket.dimension,
worldName: 'minecraft:overworld',
difficulty: 2,
hashedSeed: [0, 0],
maxPlayers: server.maxPlayers,
viewDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true,
hashedSeed: [0, 0]
isDebug: false,
isFlat: false
})

@@ -95,0 +44,0 @@

@@ -11,2 +11,4 @@ const mc = require('minecraft-protocol')

})
const mcData = require('minecraft-data')(server.version)
const loginPacket = mcData.loginPacket
var chunk = new Chunk()

@@ -24,70 +26,18 @@

server.on('login', function (client) {
const w = {
piglin_safe: {
type: 'byte',
value: 0
},
natural: {
type: 'byte',
value: 1
},
ambient_light: {
type: 'float',
value: 0
},
infiniburn: {
type: 'string',
value: 'minecraft:infiniburn_overworld'
},
respawn_anchor_works: {
type: 'byte',
value: 0
},
has_skylight: {
type: 'byte',
value: 1
},
bed_works: {
type: 'byte',
value: 1
},
has_raids: {
type: 'byte',
value: 1
},
name: {
type: 'string',
value: 'minecraft:overworld'
},
logical_height: {
type: 'int',
value: 256
},
shrunk: {
type: 'byte',
value: 0
},
ultrawarm: {
type: 'byte',
value: 0
},
has_ceiling: {
type: 'byte',
value: 0
}
}
client.write('login', {
entityId: client.id,
levelType: 'default',
isHardcore: false,
gameMode: 0,
previousGameMode: 255,
worldNames: ['minecraft:overworld'],
dimensionCodec: { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [{ name: w }] } } } },
dimension: 'minecraft:overworld',
worldNames: loginPacket.worldNames,
dimensionCodec: loginPacket.dimensionCodec,
dimension: loginPacket.dimension,
worldName: 'minecraft:overworld',
difficulty: 2,
hashedSeed: [0, 0],
maxPlayers: server.maxPlayers,
viewDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true,
hashedSeed: [0, 0]
isDebug: false,
isFlat: false
})

@@ -97,7 +47,12 @@ client.write('map_chunk', {

z: 0,
ignoreOldData: true,
groundUp: false,
bitMap: 0xffff,
chunkData: chunk.dump(),
blockEntities: []
blockEntities: [],
heightmaps: {
name: '',
type: 'compound',
value: {}
},
biomes: []
})

@@ -104,0 +59,0 @@ client.write('position', {

@@ -11,2 +11,4 @@ const mc = require('minecraft-protocol')

const server = mc.createServer(options)
const mcData = require('minecraft-data')(server.version)
const loginPacket = mcData.loginPacket

@@ -26,10 +28,16 @@ server.on('login', function (client) {

entityId: client.id,
levelType: 'default',
gameMode: 1,
dimension: 0,
difficulty: 2,
isHardcore: false,
gameMode: 0,
previousGameMode: 255,
worldNames: loginPacket.worldNames,
dimensionCodec: loginPacket.dimensionCodec,
dimension: loginPacket.dimension,
worldName: 'minecraft:overworld',
hashedSeed: [0, 0],
maxPlayers: server.maxPlayers,
viewDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true,
hashedSeed: [0, 0]
isDebug: false,
isFlat: false
})

@@ -36,0 +44,0 @@ client.write('position', {

{
"name": "minecraft-protocol",
"version": "1.16.0",
"version": "1.17.0",
"lockfileVersion": 1,

@@ -5,0 +5,0 @@ "requires": true,

{
"name": "minecraft-protocol",
"version": "1.16.0",
"version": "1.17.0",
"description": "Parse and serialize minecraft packets, plus authentication and encryption.",

@@ -53,3 +53,3 @@ "main": "src/index.js",

"lodash.merge": "^4.3.0",
"minecraft-data": "^2.59.0",
"minecraft-data": "^2.69.0",
"node-rsa": "^0.4.2",

@@ -56,0 +56,0 @@ "prismarine-nbt": "^1.3.0",

@@ -16,3 +16,3 @@ # minecraft protocol

1.10 (16w20a, 1.10-pre1, 1.10, 1.10.1, 1.10.2), 1.11 (16w35a, 1.11, 1.11.2), 1.12 (17w15a, 17w18b, 1.12-pre4, 1.12, 1.12.1, 1.12.2), and 1.13 (17w50a, 1.13, 1.13.1, 1.13.2-pre1, 1.13.2-pre2, 1.13.2), 1.14 (1.14, 1.14.1, 1.14.3, 1.14.4)
, 1.15 (1.15, 1.15.1, 1.15.2) and 1.16 (20w13b, 20w14a, 1.16-rc1, 1.16, 1.16.1)
, 1.15 (1.15, 1.15.1, 1.15.2) and 1.16 (20w13b, 20w14a, 1.16-rc1, 1.16, 1.16.1, 1.16.2, 1.16.3)
* Parses all packets and emits events with packet fields as JavaScript

@@ -93,73 +93,26 @@ objects.

port: 25565, // optional
version: '1.16'
version: '1.16.3'
});
const mcData = require('minecraft-data')(server.version)
server.on('login', function(client) {
const w = {
piglin_safe: {
type: 'byte',
value: 0
},
natural: {
type: 'byte',
value: 1
},
ambient_light: {
type: 'float',
value: 0
},
infiniburn: {
type: 'string',
value: 'minecraft:infiniburn_overworld'
},
respawn_anchor_works: {
type: 'byte',
value: 0
},
has_skylight: {
type: 'byte',
value: 1
},
bed_works: {
type: 'byte',
value: 1
},
has_raids: {
type: 'byte',
value: 1
},
name: {
type: 'string',
value: 'minecraft:overworld'
},
logical_height: {
type: 'int',
value: 256
},
shrunk: {
type: 'byte',
value: 0
},
ultrawarm: {
type: 'byte',
value: 0
},
has_ceiling: {
type: 'byte',
value: 0
}
}
let loginPacket = mcData.loginPacket
client.write('login', {
entityId: client.id,
levelType: 'default',
isHardcore: false,
gameMode: 0,
previousGameMode: 255,
worldNames: ['minecraft:overworld'],
dimensionCodec: {name: '', type:'compound', value: {dimension: {type: 'list', value: {type: 'compound', value: [w]}}}},
dimension: 'minecraft:overworld',
worldNames: loginPacket.worldNames,
dimensionCodec: loginPacket.dimensionCodec,
dimension: loginPacket.dimension,
worldName: 'minecraft:overworld',
difficulty: 2,
hashedSeed: [0, 0],
maxPlayers: server.maxPlayers,
viewDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true
enableRespawnScreen: true,
isDebug: false,
isFlat: false
});

@@ -166,0 +119,0 @@ client.write('position', {

@@ -5,6 +5,7 @@ module.exports = function (client, options) {

const parsed = JSON.parse(message.reason)
const text = parsed.text ? parsed.text : parsed
let text = parsed.text ? parsed.text : parsed
let versionRequired
if (text.translate && text.translate.startsWith('multiplayer.disconnect.outdated_')) { versionRequired = text.with[0] } else {
if (text.extra) text = text.extra[0].text
versionRequired = /(?:Outdated client! Please use|Outdated server! I'm still on) (.+)/.exec(text)

@@ -11,0 +12,0 @@ versionRequired = versionRequired ? versionRequired[1] : null

@@ -16,3 +16,4 @@ 'use strict'

const {
host = '0.0.0.0',
host = undefined, // undefined means listen to all available ipv4 and ipv6 adresses
// (see https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback for details)
'server-port': serverPort,

@@ -19,0 +20,0 @@ port = serverPort || 25565,

'use strict'
module.exports = {
defaultVersion: '1.16.1',
supportedVersions: ['1.7', '1.8', '1.9', '1.10', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.1']
defaultVersion: '1.16.3',
supportedVersions: ['1.7', '1.8', '1.9', '1.10', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.3']
}

@@ -171,3 +171,2 @@ /* eslint-env mocha */

results[typeArgs[index].name] = 1
context[typeArgs[index].name] = 1
})

@@ -174,0 +173,0 @@ return results

@@ -204,3 +204,3 @@ /* eslint-env mocha */

})
client.write('login', {
const loginPacket = {
entityId: client.id,

@@ -211,4 +211,4 @@ levelType: 'default',

worldNames: ['minecraft:overworld'],
dimensionCodec: { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [w] } } } },
dimension: version.majorVersion === '1.16' ? 'minecraft:overworld' : 0,
dimensionCodec: (version.version >= 735 ? mcData.loginPacket.dimension : { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [w] } } } }),
dimension: (version.version >= 735 ? mcData.loginPacket.dimension : 0),
worldName: 'minecraft:overworld',

@@ -218,5 +218,14 @@ hashedSeed: [0, 0],

maxPlayers: server.maxPlayers,
reducedDebugInfo: 0,
reducedDebugInfo: (version.version >= 735 ? false : 0),
enableRespawnScreen: true
})
}
if (version.version >= 735) { // 1.16x
loginPacket.isDebug = false
loginPacket.isFlat = false
loginPacket.isHardcore = false
loginPacket.viewDistance = 10
delete loginPacket.levelType
delete loginPacket.difficulty
}
client.write('login', loginPacket)
client.on('chat', function (packet) {

@@ -323,3 +332,3 @@ const message = '<' + client.username + '>' + ' ' + packet.message

})
client.write('login', {
const loginPacket = {
entityId: client.id,

@@ -330,4 +339,4 @@ levelType: 'default',

worldNames: ['minecraft:overworld'],
dimensionCodec: { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [w] } } } },
dimension: version.majorVersion === '1.16' ? 'minecraft:overworld' : 0,
dimensionCodec: (version.version >= 735 ? mcData.loginPacket.dimension : { name: '', type: 'compound', value: { dimension: { type: 'list', value: { type: 'compound', value: [w] } } } }),
dimension: (version.version >= 735 ? mcData.loginPacket.dimension : 0),
worldName: 'minecraft:overworld',

@@ -337,5 +346,14 @@ hashedSeed: [0, 0],

maxPlayers: server.maxPlayers,
reducedDebugInfo: 0,
reducedDebugInfo: (version.version >= 735 ? false : 0),
enableRespawnScreen: true
})
}
if (version.version >= 735) { // 1.16x
loginPacket.isDebug = false
loginPacket.isFlat = false
loginPacket.isHardcore = false
loginPacket.viewDistance = 10
delete loginPacket.levelType
delete loginPacket.difficulty
}
client.write('login', loginPacket)
})

@@ -342,0 +360,0 @@ server.on('close', function () {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc