Last active
March 13, 2021 02:42
-
-
Save rom1504/b8530371c7407f790ca63717ee0f8932 to your computer and use it in GitHub Desktop.
mineflayer helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chat = (o) => bot.chat(JSON.stringify(o)) | |
craft = (name, count=1) => { | |
let crafting_table = bot.findBlock({matching:mcData.blocksByName.crafting_table.id, maxDistance:5}) | |
console.log(crafting_table) | |
let item = mcData.itemsByName[name] | |
console.log(item) | |
let recipes = bot.recipesFor(item.id, item.metadata, count, crafting_table) | |
console.log(recipes) | |
bot.craft(recipes[0], count, crafting_table) | |
} | |
putInHotbar = async () => { | |
for (let i of bot.inventory.items()) { | |
if (i.slot < bot.inventory.hotbarStart) { | |
await bot.equip(i, 'hand') | |
} | |
} | |
} | |
bot.loadPlugin(pathfinder.pathfinder) | |
stop = () => { | |
bot.pathfinder.setGoal(null) | |
} | |
mineBlock = (name) => { | |
let block = bot.findBlock({matching:mcData.blocksByName[name].id, maxDistance:256}) | |
let p = block.position | |
bot.pathfinder.goto(new pathfinder.goals.GoalBlock(p.x, p.y, p.z)) | |
} |
Karang
commented
Mar 13, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment