Activity 7: Personal Bot

const {pathfinder,Movements,goals}=require('mineflayer-pathfinder')
const GoalFollow =goals.GoalFollow
bot.loadPlugin(pathfinder)
function lookAtPlayer(){
    playerEntity=bot.nearestEntity()
    if(!playerEntity) return
    pos=playerEntity.position
    bot.lookAt(pos)
}


function followPlayer(){
    const player1=bot.players['pythonul']
    if(!player1|| !player1.entity){
        return
    }
    const mcData=require('minecraft-data')(bot.version)
    const movements=new Movements(bot,mcData)
    bot.pathfinder.setMovements(movements)
    const goal=new GoalFollow(player1.entity,2)
    bot.pathfinder.setGoal(goal,true)
}