
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
bedrock-protocol
Advanced tools
Minecraft Bedrock Edition (aka MCPE) protocol library, supporting authentication and encryption. Help contribute.
Want to contribute on something important for PrismarineJS ? go to https://github.com/PrismarineJS/mineflayer/wiki/Big-Prismarine-projects
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
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: '', filtered_message: '',
message: `${packet.source_name} said: ${packet.message} on ${new Date().toLocaleString()}`
})
}
})
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
}
})
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()} !`)
})
})
const { ping } = require('bedrock-protocol')
ping({ host: 'play.cubecraft.net', port: 19132 }).then(res => {
console.log(res)
})
For documentation on the protocol, and packets/fields see the protocol documentation.
npm test
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.
Please read CONTRIBUTING.md and https://github.com/PrismarineJS/prismarine-contribute
See history
3.43.0
FAQs
Minecraft Bedrock Edition protocol library
The npm package bedrock-protocol receives a total of 448 weekly downloads. As such, bedrock-protocol popularity was classified as not popular.
We found that bedrock-protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.