Closed ChamsBypass closed 1 year ago
const mineflayer = require('mineflayer'); const color = require('chalk'); const config = require('./config.json'); const v = require('vec3') const { pathfinder, Movements } = require('mineflayer-pathfinder'); const { GoalNear } = require('mineflayer-pathfinder').goals; const bot = mineflayer.createBot({ username: name ,host:host,port:port,version:'1.12.2'}); //there reals strings but i replace bot.loadPlugin(pathfinder) bot.on('login',() => { setTimeout(() => { bot.chat('/login password password'); const customMoves = new Movements(bot); bot.pathfinder.setMovements(customMoves); bot.pathfinder.setGoal(new GoalNear(-1042.228, 32, 690.588, 1)); let npc = bot.entities['§3Anarchy']; bot.activateEntity(npc); }, 1000); })
await bot.lookAt(entity.position.offset(0, 1, 0), false) ^ TypeError: Cannot read properties of undefined (reading 'position') at EventEmitter.activateEntity (C:\Users\comp\node_modules\mineflayer\lib\plugins\inventory.js:205:29) at Timeout._onTimeout (C:\Users\comp\Documents\bot\bot.js:17:9) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7)
Why?
bot.activateEntity is being called with a null argument. Make sure it's not null and it should work.
bot.activateEntity
As a tip, you can format code by clicking on the code button on the editor next time
thanks
Why?