Giter Site home page Giter Site logo

prismarinejs / bedrock-protocol Goto Github PK

View Code? Open in Web Editor NEW
267.0 18.0 64.0 1 MB

Minecraft Bedrock protocol library, with authentication and encryption

Home Page: https://prismarinejs.github.io/minecraft-data/?v=bedrock_1.17.10&d=protocol

License: MIT License

JavaScript 99.45% Dockerfile 0.17% Shell 0.38%
minecraft-pocket-edition raknet minecraft bedrock-protocol bedrock-edition bedrock

bedrock-protocol's Introduction

bedrock-protocol

NPM version Build Status Try it on gitpod

Official Discord

Minecraft Bedrock Edition (aka MCPE) protocol library, supporting authentication and encryption. Help contribute.

Protocol doc

Features

  • Supports Minecraft Bedrock version 1.16.201, 1.16.210, 1.16.220, 1.17.0, 1.17.10, 1.17.30, 1.17.40, 1.18.0, 1.18.11, 1.18.30, 1.19.1, 1.19.10, 1.19.20, 1.19.21, 1.19.30, 1.19.40, 1.19.41, 1.19.50, 1.19.60, 1.19.62, 1.19.63, 1.19.70, 1.19.80, 1.20.0, 1.20.10, 1.20.30, 1.20.40, 1.20.50, 1.20.61, 1.20.71
  • Parse and serialize packets as JavaScript objects
  • Automatically respond to keep-alive packets
  • Proxy and mitm connections
  • Client
  • Server
    • Autheticate clients with Xbox Live
    • Ping status
  • Robust test coverage.
  • Easily extend with many other PrismarineJS projects, world providers, and more
  • Optimized for rapidly staying up to date with Minecraft protocol updates.

Want to contribute on something important for PrismarineJS ? go to https://github.com/PrismarineJS/mineflayer/wiki/Big-Prismarine-projects

Installation

npm install bedrock-protocol

To update bedrock-protocol (or any Node.js package) and its dependencies after a previous install, you must run npm update --depth 9999

Usage

Client example

Example to connect to a server in offline mode, and relay chat messages back:

const bedrock = require('bedrock-protocol')
const client = bedrock.createClient({
  host: 'localhost',   // optional
  port: 19132,         // optional, default 19132
  username: 'Notch',   // the username you want to join as, optional if online mode
  offline: true       // optional, default false. if true, do not login with Xbox Live. You will not be asked to sign-in if set to true.
})

client.on('text', (packet) => { // Listen for chat messages from the server and echo them back.
  if (packet.source_name != client.username) {
    client.queue('text', {
      type: 'chat', needs_translation: false, source_name: client.username, xuid: '', platform_chat_id: '',
      message: `${packet.source_name} said: ${packet.message} on ${new Date().toLocaleString()}`
    })
  }
})

Client example joining a Realm

Example to connect to a Realm that the authenticating account is owner of or has been invited to:

const bedrock = require('bedrock-protocol')
const client = bedrock.createClient({
  realms: {
    pickRealm: (realms) => realms[0] // Function which recieves an array of joined/owned Realms and must return a single Realm. Can be async
  }
})

Server example

Can't connect locally on Windows? See the faq

const bedrock = require('bedrock-protocol')
const server = bedrock.createServer({
  host: '0.0.0.0',       // optional. host to bind as.
  port: 19132,           // optional
  version: '1.17.10',   // optional. The server version, latest if not specified. 
})

server.on('connect', client => {
  client.on('join', () => { // The client has joined the server.
    const d = new Date()  // Once client is in the server, send a colorful kick message
    client.disconnect(`Good ${d.getHours() < 12 ? '§emorning§r' : '§3afternoon§r'} :)\n\nMy time is ${d.toLocaleString()} !`)
  })
})

Ping example

const { ping } = require('bedrock-protocol')
ping({ host: 'play.cubecraft.net', port: 19132 }).then(res => {
  console.log(res)
})

Documentation

For documentation on the protocol, and packets/fields see the protocol documentation.

Testing

npm test

Debugging

You can enable some protocol debugging output using DEBUG environment variable.

Through node.js, add process.env.DEBUG = 'minecraft-protocol' at the top of your script.

Contribute

Please read CONTRIBUTING.md and https://github.com/PrismarineJS/prismarine-contribute

History

See history

bedrock-protocol's People

Contributors

atxltheaxolotl avatar b23r0 avatar creeperg16 avatar dependabot-preview[bot] avatar dependabot[bot] avatar extremeheat avatar filiphsps avatar gameparrot avatar heath123 avatar hvlxh avatar jammspread avatar jarco-dev avatar jrcarl624 avatar justjavac avatar kaffinpx avatar kotinash avatar kurtthiemann avatar laamy avatar lucienhh avatar miniontoby avatar mrsterdy avatar nyrok avatar rom1504 avatar rom1504bot avatar snyk-bot avatar spongecade avatar stevarino avatar u9g avatar visual1mpact avatar willqizza 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bedrock-protocol's Issues

createClient parameter "profilesFolder" not working as expected

Expected Behavior
Creating a client with the parameter profilesFolder should store cached authentication tokens to that path.

Observed Behavior
Authentication tokens do get cached to the given path however after restarting the application da39a3_live-cache.json gets cleared to empty brackets {} and login needs to be verified once again.

Steps to Reproduce

  1. Create a client with a path
bedrock.createClient({
	host: ip,
	port, 
	offline: false,
	authTitle: '00000000441cc96b',
	profilesFolder: './cache',
	skipPing: true,
	onMsaCode: log => {
		console.log(log);
	},
});
  1. Authenticate with the given code and then observe that the tokens have been cached.

  2. Restart the application and you will be asked to authenticate again and da39a3_live-cache.json will be empty brackets {}

Rename some things for clarity

Some things to change for clarity:

  • Rename hostname everywhere to be just "host" to match nmp. (#74)
  • Rename src/auth/encryption to keyExchange so we don't have 2 things called encryption.js
  • rename src/auth to src/login or src/handshake maybe? Confusing because the client authentication code is in src/client.

Issues with third party servers

Some issues with third party servers (particularly GeyserMC):

  • bedrock.mcfallout.net : 19132
  • test.geysermc.net : 19132

Looks like two issues:

  • we currently crash if zlib decompression fails, we should try to decode without compression in these situations.
  • encryption issue, todo: investigate

Handling datatypes

Here's a list of datatypes ProtoDef doesn't handle

These I suspect are doable:

  • int
  • long
  • byte
  • short
  • byte_array
  • string
  • float
  • uuid
  • vector3

These may take some more work and we have to take a look at MiNET

  • slot
  • metadatadictionary
  • entitylocations
  • blockrecords
  • records
  • playerattributes
  • playerrecords
  • blockcoordinates
  • entitymotions
  • itemstacks
  • metadataints
  • recipes
  • nbt
  • skin

Protodef yaml ?

I saw https://github.com/extremeheat/protodef-yaml and I'm wondering whether it's really worth it. It feels like what was done for protodefc.
It makes it possible to use a format that's slightly easier to use for humans but that is both harder to parser and to generate for computers.
Using such yaml files as the reference in minecraft data would make it harder for users in other languages (we have a few now) to use the files.

Keeping both the yaml and the json would mean we can't edit the json file so contributors have to know both the yaml and json formats.

Do you think it's really important / useful to use that yaml format rather than json ? And if yes what would be the future of it ?

Protocol Data

I was curious where is the protocol data sourced from that protodef utilizes?
I was writing my own implementations using protodef on a personal project using the data on this repo and I realized protodef is unable to parse packets correctly if the information is not up to date 100% I suppose.

EG: I was trying to parse a resource_packs_info packet and it kept throwing an error saying it was not the expected length. Come to find out the proto yml was not up to date.

If something were to update would I need to update the yml's manually and convert it to json or how does this function? It is not well outlined.

Add packets for all versions to mcPackets and use here

seems like some things like the server example need packets:

client.write('player_list', get('packets/player_list.json'))
client.write('start_game', get('packets/start_game.json'))
client.write('item_component', { entries: [] })
client.write('set_spawn_position', get('packets/set_spawn_position.json'))
client.write('set_time', { time: 5433771 })
client.write('set_difficulty', { difficulty: 1 })
client.write('set_commands_enabled', { enabled: true })
client.write('adventure_settings', get('packets/adventure_settings.json'))
client.write('biome_definition_list', get('packets/biome_definition_list.json'))
client.write('available_entity_identifiers', get('packets/available_entity_identifiers.json'))
client.write('update_attributes', get('packets/update_attributes.json'))
client.write('creative_content', get('packets/creative_content.json'))
client.write('inventory_content', get('packets/inventory_content.json'))
client.write('player_hotbar', { selected_slot: 3, window_id: 'inventory', select_slot: true })
client.write('crafting_data', get('packets/crafting_data.json'))
client.write('available_commands', get('packets/available_commands.json'))
client.write('chunk_radius_update', { chunk_radius: 1 })
client.write('game_rules_changed', get('packets/game_rules_changed.json'))
client.write('respawn', get('packets/respawn.json'))

So I think that minecraft-packets should be used to get packets instead of generating them manually

Client/Server testing

Find a server (and/or client) mcpe implementation we can run on circle ci (ie not pocketmine, too annoying to install) and test against it

welp

how to translate %multiplayer.login.player% packet

Protodef Bug

I am getting this weird error once I try to use encapsulated packets.

Error: Read error for name : 254 is not in the mappings value

Add some basic missing client, server features

Features currently missing but in API:

Client API:

version optional Version to connect as.(Future feature, see #69) If not specified, should automatically match server version.(Current feature) Defaults to latest version

Server API:

kickTimeout | Future | How long to wait before kicking a unresponsive client.

motd Future ServerAdvertisment instance. The server advertisment shown to clients, including the message of the day, level name.

Some of these go in hand with #35

Documentation?

This project looks cool and I want to use it. But is there any documentation to look at?

How to use client.js example with PocketMine-MP docker image

Hi, my first issue on pmp so first of all thanks everyone involved, love the work you've done!

I'm trying to use client.js example with PocketMine-MP docker image with validation error result. What is a right way to do this?

$ docker run -d -p 19132:19132/udp --name minecraft_ini cscheide/pocketmine-mp:3.3.2
$ docker logs minecraft_ini

[21:06:00] [Server thread/INFO]: Loading pocketmine.yml...
[21:06:00] [Server thread/INFO]: Selected English (eng) as the base language
[21:06:00] [Server thread/INFO]: Loading server properties...
[21:06:00] [Server thread/INFO]: Starting Minecraft: Bedrock Edition server version v1.7.0
[21:06:00] [Server thread/NOTICE]: Online mode is enabled. The server will verify that players are authenticated to Xbox Live.
[21:06:00] [Server thread/NOTICE]: To disable authentication, set "xbox-auth" to "false" in server.properties.
[21:06:00] [Server thread/INFO]: Opening server on 0.0.0.0:19132
[21:06:00] [Server thread/INFO]: This server is running PocketMine-MP version 3.3.2
[21:06:00] [Server thread/INFO]: PocketMine-MP is distributed under the LGPL License
[21:06:00] [Server thread/INFO]: Loading resource packs...
[21:06:00] [Server thread/NOTICE]: Level "world" not found
[21:06:00] [Server thread/INFO]: Preparing level "world"
[21:06:00] [Server thread/NOTICE]: Spawn terrain for level "world" is being generated in the background
[21:06:00] [Server thread/INFO]: Starting GS4 status listener
[21:06:00] [Server thread/INFO]: Setting query port to 19132
[21:06:00] [Server thread/INFO]: Query running on 0.0.0.0:19132
[21:06:00] [Server thread/INFO]: Default game type: Creative Mode
[21:06:00] [Server thread/INFO]: Done (0.482s)! For help, type "help" or "?"

When I run client.js I have an validation error:

$ node client.js [docker-machine actual ip] 19132 kfern

{
  "keyword": "enum",
  "dataPath": "",
  "schemaPath": "#/oneOf/0/enum",
  "params": {
    "allowedValues": [
      "native"
    ]
  },
  "message": "should be equal to one of the allowed values",
  "schema": [
    "native"
  ],
  "parentSchema": {
    "enum": [
      "native"
    ]
  },
  "data": [
    "array",
    {
      "countType": "i8",
      "type": [
        "container",
        {
          "name": "cost",
          "type": "i32"
        },
        {
          "name": "enchantments",
          "type": [
            "array",
            {
              "countType": "i8",
              "type": [
                "container",
                {
                  "name": "id",
                  "type": "i32"
                },
                {
                  "name": "level",
                  "id": "i32"
                }
              ]
            }
          ]
        },
        {
          "name": "name",
          "type": "string"
        }
      ]
    }
  ]
}

/home/kfern/pmp/node_modules/protodef-validator/index.js:80
throw new Error("validation error");
^

Error: validation error
at Validator.validateType (/home/kfern/pmp/node_modules/protodef-validator/index.js:80:13)
at Object.keys.forEach (/home/kfern/pmp/node_modules/protodef/src/protodef.js:100:26)
at Array.forEach ()
at ProtoDef.addTypes (/home/kfern/pmp/node_modules/protodef/src/protodef.js:98:26)
at new Client (/home/kfern/pmp/node_modules/raknet/src/client.js:29:11)
at Object.createClient (/home/kfern/pmp/node_modules/raknet/src/createClient.js:22:18)
at Object.createClient (/home/kfern/pmp/node_modules/pocket-minecraft-protocol/src/createClient.js:22:21)
at Object. (/home/kfern/pmp/client.js:8:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)

ECDH support

some code :

var crypto = require('crypto');
var Ber = require('asn1').Ber;

const pubKeyStr = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEDEKneqEvcqUqqFMM1HM1A4zWjJC+I8Y+aKzG5dl+6wNOHHQ4NmG2PEXRJYhujyodFH+wO0dEr4GM1WoaWog8xsYQ6mQJAC0eVpBM96spUB1eMN56+BwlJ4H3Qx4TAvAs";

var reader = new Ber.Reader(new Buffer(pubKeyStr, "base64"));
reader.readSequence();
reader.readSequence();
reader.readOID(); // Hey, I'm an elliptic curve
reader.readOID(); // This contains the curve type, could be useful

// The first byte is unused, it contains the "number of unused bits in last octet"
// The pubKey should start at "04" which signifies it is an "uncompressed" public key.
var pubKey = new Buffer(reader.readString(Ber.BitString, true)).slice(1);

// It'd be better to get this from the curve type OID
var server = crypto.createECDH('secp384r1');
server.generateKeys();
console.log(server.computeSecret(pubKey));

It works... Until it doesnt ;-;

Once I run it it works fine until after I auth I get this error

dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
  Referenced from: /Users/wayresearcher/Code/ROHProxy/node_modules/raknet-native/prebuilds/darwin-19-x64/node-raknet.node
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ____chkstk_darwin
  Referenced from: /Users/wayresearcher/Code/ROHProxy/node_modules/raknet-native/prebuilds/darwin-19-x64/node-raknet.node
  Expected in: /usr/lib/libSystem.B.dylib

Abort trap: 6

Yes, I believe its because im on mac.

Packaging track

On the packaging track:

  • createServer
  • Check if readme is ok
  • Move protocol.json to minecraft data
  • Remove unneeded dependencies from package.json (ie bedrock provider)
  • Check whatever else doesn't belong here and either put in a subfolder in example, either put in another prismarine repo
  • Put on npm
  • Use it in mineflayer

I will keep updating this as it get better

Final objective : PrismarineJs packages have support for bedrock as good as mcpc (without duplicating packages)

0.15 support

it's a work in progress, it's being done in the realms branch here's what we've got todo

  • finish new 0.15 packet updates
  • decode JWT in the login packet
  • fe packet body encryption with incremental ECDH

i'm probably missing a few things, but once we've got the protocol fixed, we'll merge it into mc-data and use it in the release

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Use Minecraft data

The minecraft data PR was merged
Let's try to use it here
Putting the yaml in Minecraft data could also be considered if useful

Package in NPM registry not found

When I'm trying to run npm install pocket-minecraft-protcol like described in the README.md, it shows an error that the package does not exist in NPM registry.

Console output:

npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/Cellar/node/7.9.0/bin/node" "/usr/local/bin/npm" "install" "pocket-minecraft-protcol"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/pocket-minecraft-protcol
npm ERR! 404 
npm ERR! 404  'pocket-minecraft-protcol' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jarne/.npm/_logs/2017-04-15T10_17_07_458Z-debug.log

Error log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/7.9.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'pocket-minecraft-protcol' ]
2 info using [email protected]
3 info using [email protected]
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData pocket-minecraft-protcol
8 silly fetchNamedPackageData pocket-minecraft-protcol
9 silly mapToRegistry name pocket-minecraft-protcol
10 silly mapToRegistry using default registry
11 silly mapToRegistry registry https://registry.npmjs.org/
12 silly mapToRegistry data Result {
12 silly mapToRegistry   raw: 'pocket-minecraft-protcol',
12 silly mapToRegistry   scope: null,
12 silly mapToRegistry   escapedName: 'pocket-minecraft-protcol',
12 silly mapToRegistry   name: 'pocket-minecraft-protcol',
12 silly mapToRegistry   rawSpec: '',
12 silly mapToRegistry   spec: 'latest',
12 silly mapToRegistry   type: 'tag' }
13 silly mapToRegistry uri https://registry.npmjs.org/pocket-minecraft-protcol
14 verbose request uri https://registry.npmjs.org/pocket-minecraft-protcol
15 verbose request no auth needed
16 info attempt registry request try #1 at 12:17:06
17 verbose request id 0c43b0f07c4256b6
18 http request GET https://registry.npmjs.org/pocket-minecraft-protcol
19 http 404 https://registry.npmjs.org/pocket-minecraft-protcol
20 verbose headers { 'content-type': 'application/json',
20 verbose headers   'cache-control': 'max-age=0',
20 verbose headers   'content-length': '2',
20 verbose headers   'accept-ranges': 'bytes',
20 verbose headers   date: 'Sat, 15 Apr 2017 10:17:09 GMT',
20 verbose headers   via: '1.1 varnish',
20 verbose headers   age: '0',
20 verbose headers   connection: 'keep-alive',
20 verbose headers   'x-served-by': 'cache-fra1226-FRA',
20 verbose headers   'x-cache': 'MISS',
20 verbose headers   'x-cache-hits': '0',
20 verbose headers   'x-timer': 'S1492251429.786781,VS0,VE721',
20 verbose headers   vary: 'Accept-Encoding' }
21 silly get cb [ 404,
21 silly get   { 'content-type': 'application/json',
21 silly get     'cache-control': 'max-age=0',
21 silly get     'content-length': '2',
21 silly get     'accept-ranges': 'bytes',
21 silly get     date: 'Sat, 15 Apr 2017 10:17:09 GMT',
21 silly get     via: '1.1 varnish',
21 silly get     age: '0',
21 silly get     connection: 'keep-alive',
21 silly get     'x-served-by': 'cache-fra1226-FRA',
21 silly get     'x-cache': 'MISS',
21 silly get     'x-cache-hits': '0',
21 silly get     'x-timer': 'S1492251429.786781,VS0,VE721',
21 silly get     vary: 'Accept-Encoding' } ]
22 silly fetchPackageMetaData Error: Registry returned 404 for GET on https://registry.npmjs.org/pocket-minecraft-protcol
22 silly fetchPackageMetaData     at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:304:12)
22 silly fetchPackageMetaData     at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:282:14)
22 silly fetchPackageMetaData     at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:212:14)
22 silly fetchPackageMetaData     at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:186:22)
22 silly fetchPackageMetaData     at emitTwo (events.js:106:13)
22 silly fetchPackageMetaData     at Request.emit (events.js:194:7)
22 silly fetchPackageMetaData     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1081:10)
22 silly fetchPackageMetaData     at emitOne (events.js:96:13)
22 silly fetchPackageMetaData     at Request.emit (events.js:191:7)
22 silly fetchPackageMetaData     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1001:12)
22 silly fetchPackageMetaData  error for pocket-minecraft-protcol { Error: Registry returned 404 for GET on https://registry.npmjs.org/pocket-minecraft-protcol
22 silly fetchPackageMetaData     at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:304:12)
22 silly fetchPackageMetaData     at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:282:14)
22 silly fetchPackageMetaData     at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:212:14)
22 silly fetchPackageMetaData     at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:186:22)
22 silly fetchPackageMetaData     at emitTwo (events.js:106:13)
22 silly fetchPackageMetaData     at Request.emit (events.js:194:7)
22 silly fetchPackageMetaData     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1081:10)
22 silly fetchPackageMetaData     at emitOne (events.js:96:13)
22 silly fetchPackageMetaData     at Request.emit (events.js:191:7)
22 silly fetchPackageMetaData     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1001:12)
22 silly fetchPackageMetaData   pkgid: 'pocket-minecraft-protcol',
22 silly fetchPackageMetaData   statusCode: 404,
22 silly fetchPackageMetaData   code: 'E404' }
23 silly rollbackFailedOptional Starting
24 silly rollbackFailedOptional Finishing
25 silly runTopLevelLifecycles Finishing
26 silly install printInstalled
27 verbose stack Error: Registry returned 404 for GET on https://registry.npmjs.org/pocket-minecraft-protcol
27 verbose stack     at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:304:12)
27 verbose stack     at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:282:14)
27 verbose stack     at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:212:14)
27 verbose stack     at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:186:22)
27 verbose stack     at emitTwo (events.js:106:13)
27 verbose stack     at Request.emit (events.js:194:7)
27 verbose stack     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1081:10)
27 verbose stack     at emitOne (events.js:96:13)
27 verbose stack     at Request.emit (events.js:191:7)
27 verbose stack     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1001:12)
28 verbose statusCode 404
29 verbose pkgid pocket-minecraft-protcol
30 verbose cwd /Users/jarne/Downloads
31 error Darwin 16.5.0
32 error argv "/usr/local/Cellar/node/7.9.0/bin/node" "/usr/local/bin/npm" "install" "pocket-minecraft-protcol"
33 error node v7.9.0
34 error npm  v4.2.0
35 error code E404
36 error 404 Registry returned 404 for GET on https://registry.npmjs.org/pocket-minecraft-protcol
37 error 404
38 error 404 'pocket-minecraft-protcol' is not in the npm registry.
39 error 404 You should bug the author to publish it (or use the name yourself!)
40 error 404 Note that you can also install from a
41 error 404 tarball, folder, http url, or git url.
42 verbose exit [ 1, true ]

1.1 Support

This library is terribly unpredictable, before we merge anything #9 in node-raknet must be fixed. This way we can finally fix up encryption (to be honest, I'm probably going to rewrite it as a native extension... it's a little slow)

Goals:

  • Be able to maintain a session with a player and be able to finish login handshake and world sending 99% of the time, rather than 50/50 right now
  • Potentially support EDU edition and Code Blocks websockets see PEWS, just for fun 😄

Work has begun in the 1.1 branch

Cannot find module

I am not good at coding with protocol and i have this error using the ping.js in your example.

internal/modules/cjs/loader.js:303
throw err;
^

Error: Cannot find module '/home/runner/MCPEbot/node_modules/bedrock-protocol/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:295:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:508:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:802:27)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/home/runner/MCPEbot/index.js:1:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32) {
code: 'MODULE_NOT_FOUND',
path: '/home/runner/MCPEbot/node_modules/bedrock-protocol/package.json',
requestPath: 'bedrock-protocol'
}

Where size

;-;

(node:11844) UnhandledPromiseRejectionWarning: Error: Cannot find module '../../data/1.16.201/size.js'
Require stack:
- N:\Code\ServerDashboardV2\api\node_modules\pocket-minecraft-protocol\src\transforms\serializer.js
- N:\Code\ServerDashboardV2\api\node_modules\pocket-minecraft-protocol\src\client.js

Error when decoding packets when an entity moves

An error occurs when an entity moves (item, mobs, exp orbs, projectile, etc)

buffer: 124b00b3767c4301c7bc42f3bd8543000101
other buffers: 1250008cdb7d433111b2426656834300fbfb , 125a01fc5682430000b04209d7834300e5e5

Update: i got this error when connecting to server with proxy (waterdog)
ReferenceError: Read error for undefined : type1 is not defined

While decoding 6c000c000676656e69747900000000030120020676656e69747901000000031052616e6b3a20c2a73744656661756c7404067665669747902000000030b43726174653a20c2a76130060676656e69747903000000030b436f696e733a20c2a76130080676656e69747904000000030b4c6576656c3a20c2a761310a0676656e69747905000000030b456c6f3a20c2a7613130300c0676656e697479060000000319536b696c6c2047726f75703a20c2a7385b554e4b4e4f574e5d0e0676656e6974790700000003022020100676656e69747908000000030c4c6f6262793a20c2a7612331120676656e69747909000000030f506c61796572733a20c2a761313630140676656e6974790a0000000303202020160676656e6974790b0000000313c2a7657777772e76656e6974796d632e636f6d

Error again when connecting to random server (maybe error with SetScorePacket)
Buffer: 6c000102096f626a65637469766501000000031ac2a765e28c8820c2a736c2a76c416e6e6f756e63656d656e7473

Connection/login sequence

I think you had it @mhsjlw can you put it there ?
So we can make a basic server example and complete createServer (also createClient)

Integration in mineflayer

Related #65
Things to do :

  • #115 use Minecraft data
  • pchunk bedrock support
  • pblock and pitem support
  • Actual implementation in mineflayer, 2 choices. I prefer the first choice, but it depends on how difficult it would be in practice
      1. Build an abstraction layer for java and bedrock packets, build new mineflayer plugins relying on these stable clean and nice packets instead of raw packets
      1. Build mineflayer plugins for bedrock raw packets

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.