Open Itsredpro opened 2 years ago
I could not resolve this on my own.
This error appears after i am killed and didnt respawn yet, so that im in the kill screen.
My code:
const mineflayer = require('mineflayer') const pvp = require('mineflayer-pvp').plugin const armormanager = require('mineflayer-armor-manager') const { pathfinder, Movements, goals } = require('mineflayer-pathfinder') var bot = mineflayer.createBot({ username: process.argv[4], host: process.argv[2], port: process.argv[3], logErrors: false }) bot.loadPlugin(pathfinder) bot.loadPlugin(pvp) bot.loadPlugin(armormanager) function findtarget(){ var entity = bot.nearestEntity((e)=> e.type == 'player') if (!entity){ return setTimeout(()=>{ return findtarget() },5000) } if (!entity.position){ return setTimeout(()=>{ return findtarget() },5000) } return entity } bot.on('spawn', ()=>{ var entitya = findtarget() bot.pvp.attack(entitya) bot.on('stoppedAttacking', ()=>{ console.log("Stopped") var entity = findtarget() setTimeout(()=>{bot.pvp.attack(entity)},1000) }) })
So it errors after im killed when it is searching a new target and found it.
I could not resolve this on my own.
This error appears after i am killed and didnt respawn yet, so that im in the kill screen.
My code:
So it errors after im killed when it is searching a new target and found it.