Help with using chests #3148
Unanswered
sergeyMaslow
asked this question in
Q&A
Replies: 1 comment 1 reply
-
For us to help you, you need to include the error in the discussion. Also please indent your code by putting it in a codeblock. To use this mineflayer package, a minimum of JS knowledge is required. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i've seen many examples for how to open/close chests and use itself inventory, but trying to do the same have many errors.
For example i can open a chest, but the functions for closing or inventory using are unavailable.
I try to follow this example https://github.com/PrismarineJS/mineflayer/blob/master/examples/chest.js
const mineflayer = require("mineflayer")
const blockFinder = require("mineflayer-blockfinder")
const mcData1 = require("minecraft-data")
const DataMC = mcData1('1.16')
const bot = mineflayer.createBot({
host:'192.168.0.103',
port:'63143',
version:'1.16',
username:'Boris'
})
bot.loadPlugin(blockFinder())
bot.on('chat', function command(username,message){
if (username === 'Boris') return;
if (message === 'chest') placeInChest();
})
async function placeInChest()
{
bot.findBlock({
point: bot.entity.position,
matching: 147,
maxDistance:5
},function a (err,ch) {
if (ch.length){
bot.chat('found')
bot.openChest(ch[0])
ch[0].close() //calls an error "is not a function"
}
else bot.chat('no found')
})
}
Who knows how can I do it? I understand english, deutsch or russian language. I can also use Discord.
Beta Was this translation helpful? Give feedback.
All reactions