CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PrismarineJS

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: PrismarineJS/mineflayer
Path: blob/master/test/externalTests/heldItem.js
Views: 789
1
const assert = require('assert')
2
3
module.exports = () => async (bot) => {
4
const Item = require('prismarine-item')(bot.registry)
5
6
await bot.test.becomeCreative()
7
await bot.test.clearInventory()
8
await bot.test.wait(100)
9
assert.equal(bot.heldItem, null)
10
11
const stoneId = bot.registry.itemsByName.stone.id
12
await bot.test.setInventorySlot(36, new Item(stoneId, 1))
13
assert.strictEqual(bot.heldItem.id, bot.stoneId)
14
15
await bot.tossStack(bot.heldItem)
16
assert.equal(bot.heldItem, null)
17
}
18
19