craftable library fix

This commit is contained in:
Kolby Nottingham 2024-11-05 15:30:12 -08:00
parent bc511cac1a
commit 867f253b14

View file

@ -179,9 +179,9 @@ export function getCraftableItems(bot) {
* @example * @example
* let craftableItems = world.getCraftableItems(bot); * let craftableItems = world.getCraftableItems(bot);
**/ **/
let table = world.getNearestBlock(this.agent.bot, 'crafting_table'); let table = getNearestBlock(bot, 'crafting_table');
if (!table) { if (!table) {
for (const item of this.agent.bot.inventory.items()) { for (const item of bot.inventory.items()) {
if (item != null && item.name === 'crafting_table') { if (item != null && item.name === 'crafting_table') {
table = item; table = item;
break; break;
@ -190,7 +190,7 @@ export function getCraftableItems(bot) {
} }
let res = []; let res = [];
for (const item of mc.getAllItems()) { for (const item of mc.getAllItems()) {
let recipes = this.agent.bot.recipesFor(item.id, null, 1, table); let recipes = bot.recipesFor(item.id, null, 1, table);
if (recipes.length > 0) if (recipes.length > 0)
res.push(item.name); res.push(item.name);
} }