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/examples/place_entity.js
Views: 789
1
const mineflayer = require('mineflayer')
2
const { Vec3 } = require('vec3')
3
const bot = mineflayer.createBot()
4
5
bot.on('chat', async (_, msg) => {
6
if (msg === 'go_endcrystal') {
7
const crystal = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, 0, 1)), new Vec3(0, 1, 0))
8
console.log(crystal)
9
} else if (msg === 'go_boat') {
10
const boat = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, -2, -2)), new Vec3(0, 1, 0))
11
console.log(boat)
12
} else if (msg === 'go_spawnegg') {
13
const mob = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, 0, -2)), new Vec3(0, 1, 0))
14
console.log(mob)
15
} else if (msg === 'go_armorstand') {
16
const armorstand = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, 0, -2)), new Vec3(0, 1, 0))
17
console.log(armorstand)
18
}
19
})
20
21