Download Adam/ActionLib/craftCraftingTable.js from OpenCausaLab/ADAM: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/OpenCausaLab/ADAM/resolve/main/Adam/ActionLib/craftCraftingTable.js
- Command line
-
hf download hf://OpenCausaLab/ADAM/Adam/ActionLib/craftCraftingTable.js
-
curl -L -o craftCraftingTable.js https://huggingface.co/OpenCausaLab/ADAM/resolve/main/Adam/ActionLib/craftCraftingTable.js
1.11 kB
| async function craftCraftingTable(bot) { | |
| bot.chat("Start crafting Crafting Table"); | |
| const plankTypes = ["oak_planks", "birch_planks", "spruce_planks", "jungle_planks", "acacia_planks", "dark_oak_planks", "mangrove_planks"]; | |
| let totalPlanks = 0; | |
| let planksToToss = []; | |
| for (let plankType of plankTypes) { | |
| let plank = bot.inventory.findInventoryItem(mcData.itemsByName[plankType].id); | |
| if (plank) { | |
| totalPlanks += bot.inventory.count(mcData.itemsByName[plankType].id); | |
| planksToToss.push(plankType); | |
| } | |
| } | |
| if (totalPlanks < 4) { | |
| bot.chat("Not enough planks to craft a crafting table."); | |
| return; | |
| } | |
| let planksDiscarded = 0; | |
| for (let plankType of planksToToss) { | |
| if (planksDiscarded >= 4) break; | |
| let toToss = Math.min(bot.inventory.count(mcData.itemsByName[plankType].id), 4 - planksDiscarded); | |
| await bot.toss(mcData.itemsByName[plankType].id, null, toToss); | |
| planksDiscarded += toToss; | |
| } | |
| bot.chat("/give @s crafting_table"); | |
| bot.chat("Crafted a crafting_table"); | |
| } |