Socket
Socket
Sign inDemoInstall

mineflayer

Package Overview
Dependencies
Maintainers
4
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mineflayer - npm Package Compare versions

Comparing version 4.12.0 to 4.13.0

7

docs/history.md

@@ -0,1 +1,8 @@

## 4.13.0
* [Switch to entity.displayName (#3168)](https://github.com/PrismarineJS/mineflayer/commit/2409ad458b952173de669a7d9cfaeb770effe3ae) (thanks @lkwilson)
* [Update readme auth doc (#3169)](https://github.com/PrismarineJS/mineflayer/commit/f5d4a288a768ca6717fa4d22c72fb0267428c684) (thanks @extremeheat)
* [Add OpenDeliveryBot to "Projects Using Mineflayer" (#3162)](https://github.com/PrismarineJS/mineflayer/commit/ab3c0cf25d0cc28ccba89640b2ceff6ab6b4dace) (thanks @SilkePilon)
* [Use node 18 on CI (#3157)](https://github.com/PrismarineJS/mineflayer/commit/d3df34dcaa804a71bf0d8cc50a419990d4a2dce3) (thanks @extremeheat)
* [Fix ambigious function naming (#3161)](https://github.com/PrismarineJS/mineflayer/commit/9ecdf201794bfa350486839a01e318dfd94b3bfb) (thanks @frej4189)
## 4.12.0

@@ -2,0 +9,0 @@ * [Mineflayer physics refactor (#2492)](https://github.com/PrismarineJS/mineflayer/commit/d0eb3a1afe6cda7b04ae2f88052cd868ba0c0c4f) (thanks @U5B)

25

docs/README.md

@@ -83,7 +83,7 @@ # Mineflayer

host: 'localhost', // minecraft server ip
username: 'email@example.com', // minecraft username
username: 'Bot', // username or email, switch if you want to change accounts
auth: 'microsoft' // for offline mode servers, you can set this to 'offline'
// port: 25565, // only set if you need a port that isn't 25565
// version: false, // only set if you need a specific version or snapshot (ie: "1.8.9" or "1.16.5"), otherwise it's set automatically
// password: '12345678' // set if you want to use password-based auth (may be unreliable)
// password: '12345678' // set if you want to use password-based auth (may be unreliable). If specified, the `username` must be an email
})

@@ -101,2 +101,22 @@

If `auth` is set to `microsoft`, you will be prompted to login to microsoft.com with a code in your browser. After signing in on your browser,
the bot will automatically obtain and cache authentication tokens in the local file system so you don't have to sign-in again.
To switch the account, update the supplied `username`. By default, cached tokens will be stored in your user's .minecraft folder.
For more information on these options and others, see node-minecraft-protocol's [API doc](https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/docs/API.md#mccreateclientoptions).
#### Connecting to a Realm
To join a Realm that your Minecraft account has been invited to, you can pass a `realms` object with a selector function like below.
```js
const client = mineflayer.createBot({
username: 'email@example.com', // minecraft username
realms: {
// This function is called with an array of Realms the account can join. It should return the one it wants to join.
pickRealm: (realms) => realms[0]
},
auth: 'microsoft'
})
```
### See what your bot is doing

@@ -225,2 +245,3 @@

* [PrismarineJS/mineflayer-builder](https://github.com/PrismarineJS/mineflayer-builder) - Prints minecraft schematics in survival, keeping orientation
* [SilkePilon/OpenDeliveryBot](https://github.com/SilkePilon/OpenDeliveryBot) - Minecraft bot in python to deliver items from place to place.
* [and hundreds more](https://github.com/PrismarineJS/mineflayer/network/dependents) - All the projects that github detected are using mineflayer

@@ -227,0 +248,0 @@

2

examples/armor_stand.js

@@ -29,3 +29,3 @@ /*

const armorStand = bot.nearestEntity(e => e.mobType === 'Armor Stand' && bot.entity.position.distanceTo(e.position) < 4)
const armorStand = bot.nearestEntity(e => e.displayName === 'Armor Stand' && bot.entity.position.distanceTo(e.position) < 4)
if (!armorStand) {

@@ -32,0 +32,0 @@ bot.chat('No armor stands nearby!')

@@ -179,7 +179,7 @@ /*

if (entity.type === 'mob') {
console.log(`Look out! A ${entity.mobType} spawned at ${entity.position}`)
console.log(`Look out! A ${entity.displayName} spawned at ${entity.position}`)
} else if (entity.type === 'player') {
bot.chat(`Look who decided to show up: ${entity.username}`)
} else if (entity.type === 'object') {
console.log(`There's a ${entity.objectType} at ${entity.position}`)
console.log(`There's a ${entity.displayName} at ${entity.position}`)
} else if (entity.type === 'global') {

@@ -193,3 +193,3 @@ bot.chat('Ooh lightning!')

if (entity.type === 'mob') {
bot.chat(`Haha! The ${entity.mobType} got hurt!`)
bot.chat(`Haha! The ${entity.displayName} got hurt!`)
} else if (entity.type === 'player') {

@@ -219,3 +219,3 @@ bot.chat(`Aww, poor ${entity.username} got hurt. Maybe you shouldn't have a ping of ${bot.players[entity.username].ping}`)

if (entity.type === 'player' && vehicle.type === 'object') {
bot.chat(`Sweet, ${entity.username} is riding that ${vehicle.objectType}`)
bot.chat(`Sweet, ${entity.username} is riding that ${vehicle.displayName}`)
}

@@ -225,3 +225,3 @@ })

if (entity.type === 'player' && vehicle.type === 'object') {
bot.chat(`Lame, ${entity.username} stopped riding the ${vehicle.objectType}`)
bot.chat(`Lame, ${entity.username} stopped riding the ${vehicle.displayName}`)
}

@@ -228,0 +228,0 @@ })

@@ -62,3 +62,3 @@ /**

const filter = e => e.type === 'mob' && e.position.distanceTo(bot.entity.position) < 16 &&
e.mobType !== 'Armor Stand' // Mojang classifies armor stands as mobs for some reason?
e.displayName !== 'Armor Stand' // Mojang classifies armor stands as mobs for some reason?

@@ -65,0 +65,0 @@ const entity = bot.nearestEntity(filter)

@@ -111,7 +111,7 @@ /*

bot.on('mount', () => {
bot.chat(`mounted ${bot.vehicle.objectType}`)
bot.chat(`mounted ${bot.vehicle.displayName}`)
})
bot.on('dismount', (vehicle) => {
bot.chat(`dismounted ${vehicle.objectType}`)
bot.chat(`dismounted ${vehicle.displayName}`)
})

@@ -1,4 +0,4 @@

if (typeof process !== 'undefined' && parseInt(process.versions.node.split('.')[0]) < 14) {
if (typeof process !== 'undefined' && parseInt(process.versions.node.split('.')[0]) < 18) {
console.error('Your node version is currently', process.versions.node)
console.error('Please update it to a version >= 14.x.x from https://nodejs.org/')
console.error('Please update it to a version >= 18.x.x from https://nodejs.org/')
process.exit(1)

@@ -5,0 +5,0 @@ }

@@ -179,4 +179,2 @@ const { Vec3 } = require('vec3')

if (entityData) {
entity.mobType = entityData.displayName
entity.objectType = entityData.displayName
entity.displayName = entityData.displayName

@@ -192,3 +190,2 @@ entity.entityType = entityData.id

entity.entityType = type
entity.mobType = 'unknown'
entity.displayName = 'unknown'

@@ -195,0 +192,0 @@ entity.name = 'unknown'

@@ -141,4 +141,4 @@ const { Vec3 } = require('vec3')

// returns false if packet should be sent, true if not
function sendPositionPacketInDeath () {
// returns false if bot should send position packets
function isEntityRemoved () {
if (bot.isAlive === true) deadTicks = 0

@@ -152,3 +152,3 @@ if (bot.isAlive === false && deadTicks <= 20) deadTicks++

// Only send updates for 20 ticks after death
if (sendPositionPacketInDeath()) return
if (isEntityRemoved()) return

@@ -155,0 +155,0 @@ // Increment the yaw in baby steps so that notchian clients (not the server) can keep up.

{
"name": "mineflayer",
"version": "4.12.0",
"version": "4.13.0",
"description": "create minecraft bots with a stable, high level API",

@@ -30,3 +30,3 @@ "main": "index.js",

"prismarine-chunk": "^1.34.0",
"prismarine-entity": "^2.2.0",
"prismarine-entity": "^2.3.0",
"prismarine-item": "^1.14.0",

@@ -33,0 +33,0 @@ "prismarine-nbt": "^2.0.0",

@@ -83,7 +83,7 @@ # Mineflayer

host: 'localhost', // minecraft server ip
username: 'email@example.com', // minecraft username
username: 'Bot', // username or email, switch if you want to change accounts
auth: 'microsoft' // for offline mode servers, you can set this to 'offline'
// port: 25565, // only set if you need a port that isn't 25565
// version: false, // only set if you need a specific version or snapshot (ie: "1.8.9" or "1.16.5"), otherwise it's set automatically
// password: '12345678' // set if you want to use password-based auth (may be unreliable)
// password: '12345678' // set if you want to use password-based auth (may be unreliable). If specified, the `username` must be an email
})

@@ -101,2 +101,22 @@

If `auth` is set to `microsoft`, you will be prompted to login to microsoft.com with a code in your browser. After signing in on your browser,
the bot will automatically obtain and cache authentication tokens in the local file system so you don't have to sign-in again.
To switch the account, update the supplied `username`. By default, cached tokens will be stored in your user's .minecraft folder.
For more information on these options and others, see node-minecraft-protocol's [API doc](https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/docs/API.md#mccreateclientoptions).
#### Connecting to a Realm
To join a Realm that your Minecraft account has been invited to, you can pass a `realms` object with a selector function like below.
```js
const client = mineflayer.createBot({
username: 'email@example.com', // minecraft username
realms: {
// This function is called with an array of Realms the account can join. It should return the one it wants to join.
pickRealm: (realms) => realms[0]
},
auth: 'microsoft'
})
```
### See what your bot is doing

@@ -225,2 +245,3 @@

* [PrismarineJS/mineflayer-builder](https://github.com/PrismarineJS/mineflayer-builder) - Prints minecraft schematics in survival, keeping orientation
* [SilkePilon/OpenDeliveryBot](https://github.com/SilkePilon/OpenDeliveryBot) - Minecraft bot in python to deliver items from place to place.
* [and hundreds more](https://github.com/PrismarineJS/mineflayer/network/dependents) - All the projects that github detected are using mineflayer

@@ -227,0 +248,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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