PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.95k stars 904 forks source link

my bot wont find block #890

Closed MaxProg2 closed 4 years ago

MaxProg2 commented 4 years ago

i wrote a code to make my bot find block in sync, but my bot is not moving at all, i tryed from putting the example code, to changing to an minecraft server jar

rom1504 commented 4 years ago

Can you provide the full code and full error ?

On Tue, Dec 17, 2019, 15:46 MaxProg2 notifications@github.com wrote:

i wrote a code to make my bot find block in sync, but my bot is not moving at all, i tryed from putting the example code, to changing to an minecraft server jar

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/890?email_source=notifications&email_token=AAR437TANKJPMNIOBJ5KPXLQZDQ2TA5CNFSM4J34S6UKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IBCGUQQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437WXMSVRJ2ZK2XNQMF3QZDQ2TANCNFSM4J34S6UA .

MaxProg2 commented 4 years ago
const mineflayer = require('mineflayer');
const navigatePlugin = require('mineflayer-navigate')(mineflayer);
var blockFinderPlugin = require('mineflayer-blockfinder')(mineflayer);
const bot = mineflayer.createBot({ 
  username: 'SurvivalBot',
  host: 'localhost',
  port: 39307,
  version: '1.12.2',
});
// Enable Plugin
navigatePlugin(bot);
bot.loadPlugin(blockFinderPlugin);
// optional configuration

bot.once('spawn', function() {
  bot.findBlockSync({
    point: bot.entity.position,
    matching: 17,
    maxDistance: 256,
    count: 1,
  })
})
rom1504 commented 4 years ago

What is the error ?

As discussed on discord, I think you should learn some basics first. Did you start working on that already ?

On Wed, Dec 18, 2019, 01:47 MaxProg2 notifications@github.com wrote:

const mineflayer = require('mineflayer'); const navigatePlugin = require('mineflayer-navigate')(mineflayer); var blockFinderPlugin = require('mineflayer-blockfinder')(mineflayer); const bot = mineflayer.createBot({ username: 'SurvivalBot', host: 'localhost', port: 39307, version: '1.12.2', }); // Enable Plugin navigatePlugin(bot); bot.loadPlugin(blockFinderPlugin); // optional configuration

bot.once('spawn', function() { bot.findBlockSync({ point: bot.entity.position, matching: 17, maxDistance: 256, count: 1, }) })

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/890?email_source=notifications&email_token=AAR437SUTKBEQBDNDD57L5TQZFXK5A5CNFSM4J34S6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHEOX5Y#issuecomment-566815735, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437VICCK7NAISS46W57TQZFXK5ANCNFSM4J34S6UA .

MaxProg2 commented 4 years ago

yes, but i mean it gives no error, it just does not act at all, and when i kill him bot chats that he found a diamond block then leaves, it gives no error at console, its weird

rom1504 commented 4 years ago

Yes that's normal your code is not doing anything with the block you retrieved from find block

On Wed, Dec 18, 2019, 02:26 MaxProg2 notifications@github.com wrote:

yes, but i mean it gives no error, it just does not act at all, and when i kill him bot chats that he found a diamond block then leaves, it gives no error at console, its weird

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/890?email_source=notifications&email_token=AAR437R2ZXM2WNVHWMZPAHDQZF33XA5CNFSM4J34S6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHEQ6ZI#issuecomment-566824805, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437SEUNLA2MLZNI57HETQZF33XANCNFSM4J34S6UA .

MaxProg2 commented 4 years ago
const mineflayer = require('mineflayer');  --REQUIRES MODULE
const navigatePlugin = require('mineflayer-navigate')(mineflayer);
var blockFinderPlugin = require('mineflayer-blockfinder')(mineflayer);
const bot = mineflayer.createBot({   --CREATES BOT WITH OPTIONS
username: 'SurvivalBot',
host: 'localhost',
port: 39307,
version: '1.12.2',
});
// Enable Plugin
navigatePlugin(bot); --ENABLES PLUGIN IN BOT
bot.loadPlugin(blockFinderPlugin);
// optional configuration

bot.once('spawn', function() { -- BOT ON SPAWN 
bot.findBlockSync({ -- FINDS BLOCK SYNCHRONOUSLY
point: bot.entity.position, -- POSITION OF WHERE TO START
matching: 17, -- BLOCK ID
maxDistance: 256, --MAX BLOCKS DISTANCE
count: 1, --HOW MUCH BLOCKS U WANT TO FIND OF THE SAME ID
}) -- END FINDBLOCK
}) --END ONCE SPAWN
rom1504 commented 4 years ago

Ok, so this code will find a block. Is that what you want it to do ?

On Wed, Dec 18, 2019, 15:25 MaxProg2 notifications@github.com wrote:

const mineflayer = require('mineflayer'); --REQUIRES MODULE const navigatePlugin = require('mineflayer-navigate')(mineflayer); var blockFinderPlugin = require('mineflayer-blockfinder')(mineflayer); const bot = mineflayer.createBot({ --CREATES BOT WITH OPTIONS username: 'SurvivalBot', host: 'localhost', port: 39307, version: '1.12.2', }); // Enable Plugin navigatePlugin(bot); --ENABLES PLUGIN IN BOT bot.loadPlugin(blockFinderPlugin); // optional configuration

bot.once('spawn', function() { -- BOT ON SPAWN bot.findBlockSync({ -- FINDS BLOCK SYNCHRONOUSLY point: bot.entity.position, -- POSITION OF WHERE TO START matching: 17, -- BLOCK ID maxDistance: 256, --MAX BLOCKS DISTANCE count: 1, --HOW MUCH BLOCKS U WANT TO FIND OF THE SAME ID }) -- END FINDBLOCK }) --END ONCE SPAWN

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/890?email_source=notifications&email_token=AAR437TQELTHODIDR7ZDNK3QZIXGZA5CNFSM4J34S6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHGIYDI#issuecomment-567053325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437WKCJZ7A7APGRMJYH3QZIXGZANCNFSM4J34S6UA .

MaxProg2 commented 4 years ago

Yes

rom1504 commented 4 years ago

Issue solved then ?

On Wed, Dec 18, 2019, 18:21 MaxProg2 notifications@github.com wrote:

Yes

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/890?email_source=notifications&email_token=AAR437WTXXNV45YCPYSL6WLQZJLYJA5CNFSM4J34S6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHG3IYI#issuecomment-567129185, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437WGEZI4FPPOGZ4MO2TQZJLYJANCNFSM4J34S6UA .

wvffle commented 4 years ago

Seems to be resolved