GithubHelp home page GithubHelp logo

Comments (6)

extremeheat avatar extremeheat commented on May 28, 2024

Update your deps with npm update then rename your username to something else and try again

from mineflayer.

overtimepog avatar overtimepog commented on May 28, 2024

even after update

const mineflayer = require('mineflayer')
const { mineflayer: mineflayerViewer } = require('prismarine-viewer')

const bot = mineflayer.createBot({
  host: 'play.callmecarson.live', // minecraft server ip
  username: 'OvertimesBot', // username to join as if auth is `offline`, else a unique identifier for this account. Switch if you want to change accounts
  auth: 'microsoft', // for offline mode servers, you can set this to 'offline'
  version:'1.20.2',
  // port: 25565,              // set if you need a port that isn't 25565
  // version: false,           // only set if you need a specific version or snapshot (ie: "1.8.9" or "1.16.5"), otherwise it's set automatically
  // password: '12345678'      // set if you want to use password-based auth (may be unreliable). If specified, the `username` must be an email
})

bot.on('chat', (username, message) => {
  if (username === bot.username) return
  if (message = "hi")
    bot.chat("Hello!")
  
})

bot.once('spawn', () => {
  mineflayerViewer(bot, { port: 3007, firstPerson: true }) // port is the minecraft server port, if first person is false, you get a bird's-eye view
})

// Log errors and kick reasons:
bot.on('kicked', console.log)
bot.on('error', console.log)
Error: Profile not found, please restart your launcher if you recently created your profile
    at call (C:\Users\truen\Desktop\Stuff\Minecraft Bot\node_modules\yggdrasil\src\utils.js:35:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async join (C:\Users\truen\Desktop\Stuff\Minecraft Bot\node_modules\yggdrasil\src\Server.js:20:12)
Error: Profile not found, please restart your launcher if you recently created your profile
    at call (C:\Users\truen\Desktop\Stuff\Minecraft Bot\node_modules\yggdrasil\src\utils.js:35:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async join (C:\Users\truen\Desktop\Stuff\Minecraft Bot\node_modules\yggdrasil\src\Server.js:20:12)

from mineflayer.

extremeheat avatar extremeheat commented on May 28, 2024

Did you do this part?

then rename your username to something else and try again

from mineflayer.

overtimepog avatar overtimepog commented on May 28, 2024
const mineflayer = require('mineflayer')
const { mineflayer: mineflayerViewer } = require('prismarine-viewer')

const bot = mineflayer.createBot({
  host: 'play.callmecarson.live', // minecraft server ip
  auth: 'microsoft', // for offline mode servers, you can set this to 'offline'
  version:'1.20.2',
  // port: 25565,              // set if you need a port that isn't 25565
  // version: false,           // only set if you need a specific version or snapshot (ie: "1.8.9" or "1.16.5"), otherwise it's set automatically
  // password: '12345678'      // set if you want to use password-based auth (may be unreliable). If specified, the `username` must be an email
})

bot.on('chat', (username, message) => {
  if (username === bot.username) return
  if (message = "hi")
    bot.chat("Hello!")
  
})

bot.once('spawn', () => {
  mineflayerViewer(bot, { port: 3007, firstPerson: true }) // port is the minecraft server port, if first person is false, you get a bird's-eye view
})

// Log errors and kick reasons:
bot.on('kicked', console.log)
bot.on('error', console.log)
PS C:\Users\truen\Desktop\Stuff\Minecraft Bot> node bot.js
{"color":"red","text":"An internal error occurred in your connection."} false

from mineflayer.

overtimepog avatar overtimepog commented on May 28, 2024

I fixed it, for anybody who comes across this problem later this is my code

const mineflayer = require('mineflayer');
const { mineflayer: mineflayerViewer } = require('prismarine-viewer');
const pathfinder = require('mineflayer-pathfinder').pathfinder;
const Movements = require('mineflayer-pathfinder').Movements;
const { GoalNear } = require('mineflayer-pathfinder').goals;

const bot = mineflayer.createBot({
  host: 'play.callmecarson.live',
  auth: 'microsoft',
  version: '1.20.2',
});

console.log("Bot is starting...");

bot.on('login', () => {
  console.log("Bot has logged in!");
});

bot._client.on('resource_pack_send', (data) => {
  bot._client.write('resource_pack_receive', { hash: "Resourcepack", result: 3 });
  bot._client.write('resource_pack_receive', { hash: "Resourcepack", result: 0 });
});

bot.on('message', (jsonMsg) => {
  console.log(jsonMsg);
});

bot.loadPlugin(pathfinder);

let followingPlayer = null;
let followGoal = null;
let spleefMode = false;

function updateFollowGoal() {
  if (followingPlayer) {
    const player = bot.players[followingPlayer];
    if (player && player.entity) {
      const mcData = require('minecraft-data')(bot.version);
      const movements = new Movements(bot, mcData);
      movements.scafoldingBlocks = [];
      bot.pathfinder.setMovements(movements);

      const goal = new GoalNear(player.entity.position.x, player.entity.position.y, player.entity.position.z, 1);
      followGoal = goal;
      bot.pathfinder.setGoal(goal, true);
    } else {
      followingPlayer = null;
      followGoal = null;
      bot.pathfinder.setGoal(null);
      bot.chat("Player not found. Stopping following.");
    }
  }
}

function spleefBehavior() {
  if (!spleefMode) return;

  const player = bot.players[followingPlayer];
  if (player && player.entity) {
    const blockBelow = bot.blockAt(player.entity.position.offset(0, -1, 0));
    if (blockBelow && blockBelow.name === 'snow_block') {
      bot.dig(blockBelow, true);
    }
  }
}

bot.on('physicsTick', () => {
  updateFollowGoal();
  spleefBehavior();
});

bot.on('chat', (username, message) => {
  if (username === bot.username) return;

  if (message === "hi" && username === "overtimepog") {
    bot.chat("Hello!");
  } else if (message === "come to me" && username === "overtimepog") {
    followingPlayer = username;
    bot.chat("Following you now!");
  } else if (message === "stop" && username === "overtimepog") {
    followingPlayer = null;
    followGoal = null;
    bot.pathfinder.setGoal(null);
    bot.chat("Stopped following.");
  } else if (message === "spleef mode" && username === "overtimepog") {
    bot.chat("/mini join")
    spleefMode = true;
    bot.chat("Spleef mode activated!");
  } else if (message === "stop spleef" && username === "overtimepog") {
    spleefMode = false;
    bot.chat("Spleef mode deactivated.");
  }
});

bot.once('spawn', () => {
  console.log("Bot has spawned!");
  mineflayerViewer(bot, { port: 3007, firstPerson: true });
});

// Log errors and kick reasons:
bot.on('kicked', console.log);
bot.on('error', console.log);

from mineflayer.

extremeheat avatar extremeheat commented on May 28, 2024

Actually, none of that should be relevant, your issue is caused before the client is able to join the server at all. This means you need to 1. update your dependencies and 2. ensure that it's not caused by an invalid cached credentials by changing your username to force a re-sign in.

from mineflayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.