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/fishing.js
Views: 789
1
module.exports = () => async (bot) => {
2
const Item = require('prismarine-item')(bot.registry)
3
4
bot.test.sayEverywhere('/fill ~-10 ~-1 ~-10 ~10 ~-1 ~10 water')
5
await bot.test.setInventorySlot(36, new Item(bot.registry.itemsByName.fishing_rod.id, 1, 0))
6
await bot.lookAt(bot.entity.position) // dont force the position
7
bot.fish()
8
9
return new Promise((resolve, reject) => {
10
function onPlayerCollect (collector, collected) {
11
if (collected.name.toLowerCase() === 'item' || collected.type === 'object') {
12
bot.test.sayEverywhere('I caught: ' + collected.displayName)
13
bot.removeListener('playerCollect', onPlayerCollect)
14
resolve()
15
}
16
}
17
bot.on('playerCollect', onPlayerCollect)
18
})
19
}
20
21