Skip to content

Commit e3f89d1

Browse files
authored
Fix knockback physics crash (#3715)
1 parent 55e8ed3 commit e3f89d1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/plugins/physics.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,10 @@ function inject (bot, { physicsEnabled, maxCatchupTicks }) {
296296
// TODO: emit an explosion event with more info
297297
if (bot.physicsEnabled && bot.game.gameMode !== 'creative') {
298298
if (explosion.playerKnockback) { // 1.21.3+
299-
bot.entity.velocity.add(explosion.playerMotionX, explosion.playerMotionY, explosion.playerMotionZ)
299+
// Fixes issue #3635
300+
bot.entity.velocity.x += explosion.playerKnockback.x
301+
bot.entity.velocity.y += explosion.playerKnockback.y
302+
bot.entity.velocity.z += explosion.playerKnockback.z
300303
}
301304
if ('playerMotionX' in explosion) {
302305
bot.entity.velocity.x += explosion.playerMotionX

0 commit comments

Comments
 (0)