-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finding a chest, opening it. #20
Comments
I advise you use mineflayer findBlocks which is now faster and better than
this package
…On Wed, Aug 26, 2020, 20:07 TGamingStudio ***@***.***> wrote:
Minecraft version 1.16.1
Hello, I found this example of chest opening and withdrawing items.
https://github.com/PrismarineJS/mineflayer/blob/1abfe102766175b27fa39cb6cf587da6fc9a2d9a/examples/chest.js
But I couldn't find a chest.
So I found this plugin and tried the usage example.
I lowered the maxDistance, otherwise, it crashes. I placed a diamond ore
next to the player, and it didn't find a single block.
It just returns an empty array
If there's no way to fix this. Is there a way to open a chest at given
coords? (constructing a Block)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#20>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR437SPAYCATUNVYTAIW4LSCVFNHANCNFSM4QMDMLRA>
.
|
@rom1504 I figured out a better way I think. Specifying the coords of the chest, finding a bock at the coords, opening it. Anyway can you please refer to the documentation of findBlocks This is the fix i've done for (var item of openChest.items()) {
openChest.withdraw(item.type, null, item.count, (err) => {
if (err) console.log(err)
})
await sleep(500) //otherwise it throws error: server rejected transaction
} |
That's because you use a normal loop, you need to use the callback to
trigger the next iteration instead
…On Wed, Aug 26, 2020, 20:40 TGamingStudio ***@***.***> wrote:
@rom1504 <https://github.com/rom1504> I figured out a better way I think.
Specifying the coords of the chest, finding a bock at the coords, opening
it.
It will also open the right chest.
Anyway can you please refer to the documentation of findBlocks
But I've got an issue with withdrawing all of the items now.
for (var item in openChest.items()) {
openChest.withdraw(item.type, null, item.count, (err) => {
if (err) console.log(err)
})
}
returns errors
Error: missing source item undefined:null in (0,27)
at transferOne (D:\Documents\Code\Javascript\mc\node_modules\mineflayer\lib\plugins\inventory.js:262:36)
at Bot.transfer (D:\Documents\Code\Javascript\mc\node_modules\mineflayer\lib\plugins\inventory.js:251:5)
at Chest.withdraw (D:\Documents\Code\Javascript\mc\node_modules\mineflayer\lib\plugins\chest.js:51:11)
at Bot.<anonymous> (D:\Documents\Code\Javascript\mc\index.js:40:15)
Once I use for item of items
i get this error
Error: Server rejected transaction.
at Bot.<anonymous> (D:\Documents\Code\Javascript\mc\node_modules\mineflayer\lib\plugins\inventory.js:552:12)
at Object.onceWrapper (events.js:417:26)
at Bot.emit (events.js:310:20)
at onRejected (D:\Documents\Code\Javascript\mc\node_modules\mineflayer\lib\plugins\inventory.js:508:11)
at confirmTransaction (D:\Documents\Code\Javascript\mc\node_modules\mineflayer\lib\plugins\inventory.js:491:7)
at Client.<anonymous> (D:\Documents\Code\Javascript\mc\node_modules\mineflayer\lib\plugins\inventory.js:595:5)
at Client.emit (events.js:310:20)
at FullPacketParser.<anonymous> (D:\Documents\Code\Javascript\mc\node_modules\minecraft-protocol\src\client.js:89:12)
at FullPacketParser.emit (events.js:310:20)
at addChunk (D:\Documents\Code\Javascript\mc\node_modules\readable-stream\lib\_stream_readable.js:298:12)```
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR437R37UABDBFVEM2DNB3SCVJJTANCNFSM4QMDMLRA>
.
|
@rom1504 Callback where? Should it be the callback on withdraw function? Can you provide an example? |
Also are item types listed somewhere? Melon is 735. Doesn't seem like actual ids.. |
Yes look mineflayer doc. And minecraft data one. Under PrismarineJS.
You're in the wrong project here
…On Wed, Aug 26, 2020, 22:24 TGamingStudio ***@***.***> wrote:
Also are item types listed somewhere? Melon is 735. Doesn't seem like
actual ids..
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR437WDX3VUFAI3URREZH3SCVVPRANCNFSM4QMDMLRA>
.
|
Minecraft version 1.16.1
Hello, I found this example of chest opening and withdrawing items. https://github.com/PrismarineJS/mineflayer/blob/1abfe102766175b27fa39cb6cf587da6fc9a2d9a/examples/chest.js
But I couldn't find a chest.
So I found this plugin and tried the usage example.
I lowered the maxDistance, otherwise, it crashes. I placed a diamond ore next to the player, and it didn't find a single block.
It just returns an empty array
If there's no way to fix this. Is there a way to open a chest at given coords? (constructing a Block)
The text was updated successfully, but these errors were encountered: