Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
4aaa065
add my physics plugin to see if it works
GenerelSchwerz Sep 10, 2024
75973b5
fix linting
GenerelSchwerz Sep 10, 2024
7a98017
update to dynamically load context
GenerelSchwerz Sep 10, 2024
c9d8be0
maybe there are issues...
GenerelSchwerz Sep 10, 2024
44793ca
rough fixes
GenerelSchwerz Sep 10, 2024
ad615f7
fixed elytra flight.
GenerelSchwerz Sep 10, 2024
9b7d48f
1.8.8 passed.
GenerelSchwerz Sep 10, 2024
34c7adc
Merge branch 'PrismarineJS:master' into master
GenerelSchwerz Sep 19, 2024
a80cb3d
Merge remote-tracking branch 'upstream/master'
GenerelSchwerz Jan 20, 2025
fbfca39
hacky fix
GenerelSchwerz Jan 20, 2025
d8f4eb6
bigger hacky fix
GenerelSchwerz Jan 20, 2025
39ec411
biggest hacky fix
GenerelSchwerz Jan 20, 2025
0962694
less hacky solution.
GenerelSchwerz Jan 22, 2025
a4ea501
remove debug statement
GenerelSchwerz Jan 22, 2025
47cc73c
weird bug
GenerelSchwerz Jan 22, 2025
6ae5184
Merge remote-tracking branch 'upstream/master'
GenerelSchwerz Jan 22, 2025
ebe8721
test
GenerelSchwerz Jan 29, 2025
8ca7b8f
updated to botcraftPhysics code
GenerelSchwerz Jan 29, 2025
dcd1fbf
ADD ABILITIES!!!
zardoy Jan 29, 2025
0836841
fix lint
GenerelSchwerz Jan 29, 2025
547588f
bump physics
GenerelSchwerz Jan 29, 2025
4e5e37a
fix CI
GenerelSchwerz Jan 29, 2025
d8a998e
bump physics
GenerelSchwerz Jan 29, 2025
7d24307
Merge pull request #2 from zardoy/abilities
GenerelSchwerz Jan 29, 2025
3f4e0ba
bump physics
GenerelSchwerz Jan 30, 2025
c8607e1
bump physics
GenerelSchwerz Jan 30, 2025
6e0e93a
bump physics
GenerelSchwerz Jan 30, 2025
400ceb2
bump physics
GenerelSchwerz Jan 31, 2025
dde528c
fixed some random tick stuff, but movement is still messed up
GenerelSchwerz Feb 11, 2025
b568984
potential fix for everything physics related, but unstable.
GenerelSchwerz Feb 28, 2025
7c5b0c3
Merge pull request #3 from PrismarineJS/master
GenerelSchwerz Mar 15, 2025
71435b7
expose ctx for debugging (I got you zardoy)
GenerelSchwerz Mar 15, 2025
0fbc68e
fix: fix invalid packets order check in sonar (position_look should b…
zardoy Mar 16, 2025
1e61398
all packets are being sent when in vehicle correctly!
zardoy Mar 16, 2025
5ab5781
MC client accurate implementation
Nya0 Mar 17, 2025
b4a28ef
Merge pull request #5 from zardoy/vehicles
GenerelSchwerz Mar 17, 2025
0e1eda0
Merge remote-tracking branch 'origin/master' into gen-physics-look
zardoy Mar 20, 2025
e9766e0
Merge pull request #4 from zardoy/gen-physics-look
GenerelSchwerz Mar 20, 2025
cf26452
Merge pull request #6 from Nya0/fet-positionUpdated
GenerelSchwerz Mar 20, 2025
69386cd
fix physics calc prevention
zardoy Mar 20, 2025
bb682c4
Merge pull request #7 from zardoy/literally-fix-physics
GenerelSchwerz Mar 20, 2025
08560aa
update physics
GenerelSchwerz Mar 22, 2025
729e4ba
Merge pull request #8 from PrismarineJS/master
GenerelSchwerz Mar 22, 2025
ed0e9f6
fix entity memory leak
zardoy Mar 29, 2025
ad36612
ray raycast block
zardoy Mar 29, 2025
16ef77f
fix heldItemChanged
zardoy Mar 29, 2025
f8bc579
Merge pull request #12 from PrismarineJS/master
GenerelSchwerz Apr 7, 2025
863dfd7
Merge pull request #9 from zardoy/entities
GenerelSchwerz Apr 7, 2025
6ba735f
Merge pull request #10 from zardoy/fix-raycast
GenerelSchwerz Apr 7, 2025
83d7687
Merge pull request #11 from zardoy/heldItemChanged
GenerelSchwerz Apr 7, 2025
5adf8d3
fix blockAtCursor infinite loop
zardoy Apr 7, 2025
210af8c
update physics
GenerelSchwerz Apr 7, 2025
fca01b0
Merge pull request #13 from zardoy/fix-crash
GenerelSchwerz Apr 7, 2025
d459d2e
bruh
GenerelSchwerz Apr 8, 2025
fde7352
tryfix
zardoy Apr 21, 2025
79c59bd
regression: players are removed on dimension change
zardoy Apr 30, 2025
aadfaaf
FIX ENTITY PITCH/YAW
zardoy Apr 30, 2025
dea2f95
fix yaw sync
zardoy Apr 30, 2025
7034f98
sometimes server sends yaw/pitch 0 for some reason. todo validate aga…
zardoy Apr 30, 2025
5602eca
fix eye height in flying
zardoy May 1, 2025
b8eef44
Merge pull request #14 from PrismarineJS/master
GenerelSchwerz May 13, 2025
e4818de
literally fix crafting on 1.16.5 and below!
zardoy May 18, 2025
281fb8d
Merge pull request #16 from PrismarineJS/master
GenerelSchwerz May 21, 2025
73cb436
Merge pull request #15 from zardoy/sync-branch
GenerelSchwerz May 21, 2025
a40a205
Merge branch 'master' of https://github.com/PrismarineJS/mineflayer i…
GenerelSchwerz Aug 3, 2025
203f092
use bm's pchunk and pworld
aesthetic0001 Aug 10, 2025
792399d
add random sensitivity
aesthetic0001 Aug 15, 2025
1f0fba4
remove .idea
aesthetic0001 Aug 15, 2025
13360d5
clamp yaw and pitch according to yawSpeed, pitchSpeed
aesthetic0001 Aug 15, 2025
b7d7d92
ac fix: only send entity_action on each tick
aesthetic0001 Aug 15, 2025
428fa1d
feat: add spoofControlState
aesthetic0001 Aug 15, 2025
548b322
use bm's nmp
aesthetic0001 Aug 15, 2025
61d08b6
Update package.json
aesthetic0001 Aug 17, 2025
c53ce7b
Update entities.js
aesthetic0001 Aug 18, 2025
ef8fc45
Update entities.js
aesthetic0001 Aug 18, 2025
472a72d
Update inventory.js
aesthetic0001 Aug 19, 2025
60f0d49
upd: remove clamping
aesthetic0001 Sep 2, 2025
a7bab22
feat: clamp pitch within vanilla pitches
aesthetic0001 Sep 5, 2025
c3fb9ce
chore: readd clamping
aesthetic0001 Sep 5, 2025
cd57370
write tick_end
aesthetic0001 Sep 10, 2025
b371a4b
upd deps to use binmasterdotpro prismarinejs forks
aesthetic0001 Sep 29, 2025
ec12016
Change velocity update method to set
aesthetic0001 Sep 30, 2025
ce38692
send player_input packet
aesthetic0001 Sep 30, 2025
da45c17
sync assignment of force looks
aesthetic0001 Oct 1, 2025
aa8d483
Update physics.js
aesthetic0001 Oct 14, 2025
b90aba4
fix grimac badpacketsv flag
aesthetic0001 Oct 15, 2025
62b0b73
fix grimac badpacketsE
aesthetic0001 Oct 20, 2025
7fb05a8
fix physics desync over time (grim simulation)
aesthetic0001 Oct 22, 2025
a934763
clear control states on respawn (grim simulation)
aesthetic0001 Oct 22, 2025
d84e23c
fix aimmodulo360
aesthetic0001 Oct 22, 2025
38f9cdd
fixed mineflayer physics on 1.8.9 to pass grimac prediction
aesthetic0001 Oct 24, 2025
b1f9692
fix non-force look & lookat behavior
aesthetic0001 Oct 24, 2025
5ab6fa9
update readme
aesthetic0001 Oct 24, 2025
16bd129
reset lastsent and controls on server change
aesthetic0001 Oct 25, 2025
3e6ffcd
update ref to lastsent when resetting
aesthetic0001 Oct 25, 2025
422c247
Reset bot's yawdeg and pitchdeg on respawn and login
aesthetic0001 Oct 25, 2025
151c247
update server side sprinting
aesthetic0001 Nov 2, 2025
4775e0a
Refactor sprinting logic in physics.js
aesthetic0001 Nov 2, 2025
e956889
compute wall block BB correctly
aesthetic0001 Nov 4, 2025
2b72576
remove wall aabb calculation from blocks side
aesthetic0001 Nov 4, 2025
9f1a5a0
vanilla behavior change
aesthetic0001 Nov 9, 2025
046fa5c
update readme
aesthetic0001 Nov 9, 2025
903e8c8
fix lookUpdated check
aesthetic0001 Nov 9, 2025
acaa4d7
re-add non-force look
aesthetic0001 Nov 9, 2025
5a6e406
update isSprintingApplicable to include no liquid
aesthetic0001 Nov 12, 2025
8ff019e
dont autoround for s2c position packets
aesthetic0001 Nov 18, 2025
db51dcf
use FastWorld from bm prismarine-physics
aesthetic0001 Dec 12, 2025
ef05bc0
Update physics.js
aesthetic0001 Dec 13, 2025
49a03de
fix grim badpacketsv
aesthetic0001 Dec 26, 2025
b9d4e30
Add Velocity proxy support for Minecraft 1.20.2+ configuration phase
StarWeizz Dec 14, 2025
e3784d1
Fix velocity plugin: don't interfere with initial login configuration
Feb 14, 2026
3a29033
Backport velocity naming changes
SuperGamerTron Feb 20, 2026
34ac7a3
Update ci.yml
SuperGamerTron Feb 20, 2026
edb4b6c
Update package.json
SuperGamerTron Feb 20, 2026
c9ed7cb
Merge branch 'master' into master
GenerelSchwerz Feb 21, 2026
4bc0e0a
fix support for pathfinder, aka backwards compatibility
GenerelSchwerz Feb 21, 2026
198e844
force physics to respect yaw look interpolation
GenerelSchwerz Feb 21, 2026
5301562
better typing
GenerelSchwerz Feb 21, 2026
9bd3aca
update physics support
GenerelSchwerz Feb 22, 2026
6ce66cc
add support for pathfinder
GenerelSchwerz Feb 22, 2026
68ea121
Merge branch 'master' into binmasterdotpro/master
Mar 10, 2026
d19d70f
small changes
Mar 10, 2026
8b583a7
merge various handlers for physics
Mar 10, 2026
4022184
merge appears mostly complete
Mar 10, 2026
40f731f
add better default setting for mineflayer
Mar 10, 2026
1f4a0fb
handle merge
Mar 10, 2026
d3fdd9c
Merge branch 'master' into binmasterdotpro/master
Mar 10, 2026
5994816
fix readme
Mar 10, 2026
27b81ef
fix basic tests
Mar 10, 2026
1cb3b07
remove dumb logs
Mar 10, 2026
b84d50d
add reversion of creative flight
Mar 10, 2026
260c6db
update test to not suck
Mar 10, 2026
2437074
fix test to pull random port
Mar 10, 2026
d687d3c
fix elytra flight
Mar 10, 2026
cc6c71f
add fishing bobber support to entities.js
Mar 10, 2026
c4bd50c
respond to comment
Mar 10, 2026
b346644
Update ci.yml
extremeheat Mar 26, 2026
4e17f45
Update package.json
extremeheat Mar 26, 2026
fa70057
dbg
extremeheat Mar 26, 2026
085187b
add support for CI manually on other branches
Mar 28, 2026
d634199
Merge branch 'master' into master
rom1504 Mar 30, 2026
3edb4f4
Update prismarine-recipe dependency to a specific branch
rom1504 Mar 30, 2026
600ef51
merge with upstream
Mar 31, 2026
b4a10b8
Merge branch 'master' into consistent-velocity
SuperGamerTron Apr 12, 2026
39fccdb
Remove debug logging
SuperGamerTron Apr 12, 2026
0bfbff7
merge with upstream
GenerelSchwerz Apr 17, 2026
35f557f
Merge branch 'master' into consistent-velocity
extremeheat Apr 29, 2026
9f7d3d9
add crafting util to readme
GenerelSchwerz May 10, 2026
4bed87b
Merge branch 'PrismarineJS:master' into master
GenerelSchwerz May 18, 2026
4babe0c
Merge remote-tracking branch 'upstream/pr-3839' into crafting-util-ad…
GenerelSchwerz May 18, 2026
c6dbf05
Merge branch 'crafting-util-adding'
GenerelSchwerz May 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- master
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ test/server_*
.vscode
.DS_Store
launcher_accounts.json
data
data
.idea
custom_tests
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ The most updated and useful are :
* [Projectile](https://github.com/firejoust/mineflayer-projectile) - Get the required launch angle for projectiles
* [Movement](https://github.com/firejoust/mineflayer-movement) - Smooth and realistic player movement, best suited for PvP
* [Collect Block](https://github.com/PrismarineJS/mineflayer-collectblock) - Quick and simple block collection API.
* [Crafting Util](https://github.com/generelschwerz/mineflayer-crafting-util) - Crafting planner and execution helpers for Mineflayer bots.

But also check out :

Expand Down
15 changes: 13 additions & 2 deletions examples/jumper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* This bot can move, jump, ride vehicles, attack nearby entities and much more.
*/
const mineflayer = require('mineflayer')
const mineflayer = require('..')

if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node jumper.js <host> <port> [<name>] [<password>]')
Expand All @@ -21,6 +21,17 @@ const bot = mineflayer.createBot({

let target = null

bot.on('move', (lastPos) => {
console.log(`I moved from ${JSON.stringify(lastPos)} to ${JSON.stringify(bot.entity.position)}`)
console.log(`I have ${bot.entity.velocity.toString()} velocity`)
console.log(`I am on the ground: ${bot.entity.onGround}`)
// console.log(bot.entity)
})

bot.on('forcedMove', () => {
console.log('I am being forced to move')
})

bot.on('chat', (username, message) => {
if (username === bot.username) return
target = bot.players[username].entity
Expand Down Expand Up @@ -103,7 +114,7 @@ bot.once('spawn', () => {

function watchTarget () {
if (!target) return
bot.lookAt(target.position.offset(0, target.height, 0))
bot.lookAt(target.position.offset(0, target.height, 0), true)
}
})

Expand Down
35 changes: 29 additions & 6 deletions examples/pathfinder/gps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// This is an example that uses mineflayer-pathfinder to showcase how simple it is to walk to goals

const mineflayer = require('mineflayer')
const { pathfinder, Movements, goals: { GoalNear } } = require('mineflayer-pathfinder')
const mineflayer = require('../../')
const {
pathfinder,
Movements,
goals: { GoalNear }
} = require('mineflayer-pathfinder')

if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node gps.js <host> <port> [<name>] [<password>]')
Expand All @@ -22,17 +26,36 @@ bot.loadPlugin(pathfinder)
bot.once('spawn', () => {
const defaultMove = new Movements(bot)

bot.physics.yawSpeed = 5000
bot.physics.pitchSpeed = 5000

bot.on('chat', (username, message) => {
console.log('Chat message received: ', username, message)
if (username === bot.username) return
if (message !== 'come') return

const [cmd] = message.split(' ')

const target = bot.players[username]?.entity
if (!target) {
bot.chat("I don't see you !")
return
}
const { x: playerX, y: playerY, z: playerZ } = target.position

bot.pathfinder.setMovements(defaultMove)
bot.pathfinder.setGoal(new GoalNear(playerX, playerY, playerZ, RANGE_GOAL))
switch (cmd) {
case 'come': {
const { x: playerX, y: playerY, z: playerZ } = target.position

bot.pathfinder.setMovements(defaultMove)
bot.pathfinder.setGoal(new GoalNear(playerX, playerY, playerZ, RANGE_GOAL))
break
}
case 'forward': {
bot.lookAt(target.position)
bot.setControlState('forward', true)
break
}
}
})
})

bot.on('error', (err) => console.log(err))
4 changes: 2 additions & 2 deletions examples/pathfinder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"mineflayer-pathfinder": "^2.4.5",
"mineflayer": "file:../../"
"mineflayer": "file:../../",
"mineflayer-pathfinder": "^2.4.5"
},
"description": "A mineflayer example"
}
56 changes: 56 additions & 0 deletions examples/velocity_manual_resourcepack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* This example shows how to disable the velocity plugin
* and manually handle resource packs during Velocity transfers
*
* Use this if you want full control over resource pack acceptance
* instead of the automatic behavior.
*
* WARNING: Disabling the velocity plugin will cause bot disconnections
* during Velocity server transfers unless you handle the configuration
* phase manually (advanced users only).
*/
const mineflayer = require('mineflayer')

if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node velocity_manual_resourcepack.js <host> <port> [<name>] [online?]')
process.exit(1)
}

const bot = mineflayer.createBot({
host: process.argv[2],
port: parseInt(process.argv[3]),
username: process.argv[4] ? process.argv[4] : 'manual_bot',
auth: process.argv[5] ? 'microsoft' : 'offline',
// Disable the velocity plugin
plugins: {
velocity: false
}
})

bot.on('login', () => {
console.log('Logged in (velocity plugin disabled)')
})

bot.on('spawn', () => {
console.log('Spawned in server:', bot.game.dimension)
})

// Manually accept resource packs
bot.on('resourcePack', (url, uuid) => {
console.log('Resource pack received:', url)
console.log('Accepting manually...')
bot.acceptResourcePack()
})

bot.on('end', (reason) => {
console.log('Bot disconnected:', reason)
})

bot.on('error', (err) => {
console.error('Error:', err.message)
})

bot.on('kicked', (reason) => {
console.log('Kicked:', reason)
console.log('Note: If kicked during transfer, you may need to enable the velocity plugin')
})
69 changes: 69 additions & 0 deletions examples/velocity_transfer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* This example demonstrates connecting to a Velocity proxy server
* and handling server transfers (1.20.2+)
*
* The velocity plugin is loaded by default and will automatically:
* - Handle the configuration phase during transfers
* - Accept resource packs during configuration
* - Block physics packets while in configuration phase
* - Re-enable physics after configuration completes
*
* To disable the velocity plugin, add to createBot options:
* plugins: { velocity: false }
*
* Note: The plugin is harmless even if loaded - it only activates
* during configuration phase (Velocity transfers, not normal gameplay)
*
* This fixes the issue: https://github.com/PrismarineJS/mineflayer/issues/3764
*/
const mineflayer = require('mineflayer')

if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node velocity_transfer.js <host> <port> [<name>] [online?]')
process.exit(1)
}

const bot = mineflayer.createBot({
host: process.argv[2],
port: parseInt(process.argv[3]),
username: process.argv[4] ? process.argv[4] : 'velocity_bot',
auth: process.argv[5] ? 'microsoft' : 'offline'
// The velocity plugin is enabled by default
// To disable it, uncomment the following line:
// plugins: { velocity: false }
})

bot.on('login', () => {
console.log('Logged in to Velocity proxy')
})

bot.on('spawn', () => {
console.log('Spawned in server:', bot.game.dimension)
})

// Track configuration phase events
bot.on('configurationPhase', (phase) => {
if (phase === 'start') {
console.log('Entering configuration phase (server transfer starting...)')
} else if (phase === 'end') {
console.log('Exiting configuration phase (server transfer complete)')
}
})

// Optional: Track resource pack acceptance
bot.on('resourcePack', (url, uuid) => {
console.log('Resource pack received:', url)
console.log('Note: Resource packs are automatically accepted during configuration phase')
})

bot.on('end', (reason) => {
console.log('Bot disconnected:', reason)
})

bot.on('error', (err) => {
console.error('Error:', err.message)
})

bot.on('kicked', (reason) => {
console.log('Kicked:', reason)
})
17 changes: 16 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export interface BotEvents {
unmatchedMessage: (stringMsg: string, jsonMsg: ChatMessage) => Promise<void> | void
inject_allowed: () => Promise<void> | void
login: () => Promise<void> | void
worldSwitch: () => Promise<void> | void
/** When `respawn` option is disabled, you can call this method manually to respawn. */
spawn: () => Promise<void> | void
respawn: () => Promise<void> | void
Expand Down Expand Up @@ -164,6 +165,8 @@ export interface BotEvents {
resourcePack: (url: string, hash?: string, uuid?: string) => Promise<void> | void
heldItemChanged: (newItem: Item | null) => Promise<void> | void
particle: (particle: Particle) => Promise<void> | void
heldItemChanged: (newItem: Item | null) => Promise<void> | void
abilities: (abilities: Abilities) => Promise<void> | void
}

export interface CommandBlockOptions {
Expand All @@ -178,7 +181,13 @@ export interface Bot extends TypedEmitter<BotEvents> {
protocolVersion: string
majorVersion: string
version: string
entity: Entity
entity: Entity & {
abilities: Abilities
isInvulnerable: boolean
isFlying: boolean
canFly: boolean
canInstantlyBuild: boolean
}
entities: { [id: string]: Entity }
fireworkRocketDuration: number
spawnPoint: Vec3
Expand Down Expand Up @@ -896,3 +905,9 @@ export let latestSupportedVersion: string
export let oldestSupportedVersion: string

export function supportFeature (feature: string, version: string): boolean

export interface Abilities {
flags: number
flyingSpeed: number
walkingSpeed: number
}
10 changes: 10 additions & 0 deletions lib/conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ exports.toNotchianYaw = yaw => toDegrees(PI - yaw)
exports.toNotchianPitch = pitch => toDegrees(-pitch)
exports.fromNotchianYawByte = yaw => fromNotchianYaw(yaw * FROM_NOTCH_BYTE)
exports.fromNotchianPitchByte = pitch => fromNotchianPitch(pitch * FROM_NOTCH_BYTE)
exports.fromDegreesToPitch = fromDegreesToPitch
exports.fromDegreesToYaw = fromDegreesToYaw

function toRadians (degrees) {
return TO_RAD * degrees
Expand All @@ -38,3 +40,11 @@ function fromNotchianPitch (pitch) {
function fromNotchVelocity (vel) {
return new Vec3(vel.x * FROM_NOTCH_VEL, vel.y * FROM_NOTCH_VEL, vel.z * FROM_NOTCH_VEL)
}

function fromDegreesToPitch (degrees) {
return euclideanMod(toRadians(-degrees) + PI, PI_2) - PI
}

function fromDegreesToYaw (degrees) {
return euclideanMod(PI - toRadians(degrees), PI_2)
}
Loading
Loading