hunting fix

This commit is contained in:
Kolby Nottingham 2024-02-12 22:53:26 -08:00
parent 57783fb4ca
commit 6b123c275e
3 changed files with 6 additions and 4 deletions

View file

@ -7,7 +7,7 @@
"torch", "torch",
"stone_pickaxe", "stone_pickaxe",
"stone_sword", "stone_sword",
"leather_tunic", "leather_chestplate",
"iron_pickaxe", "iron_pickaxe",
"iron_sword", "iron_sword",
"iron_helmet", "iron_helmet",

View file

@ -192,7 +192,6 @@ class ItemWrapper {
this.methods.push(method); this.methods.push(method);
} }
createChildren() { createChildren() {
let recipes = mc.getItemCraftingRecipes(this.name); let recipes = mc.getItemCraftingRecipes(this.name);
if (recipes) { if (recipes) {
@ -302,7 +301,8 @@ export class ItemGoal {
let next = goal.getNext(); let next = goal.getNext();
// Prevent unnecessary attempts to obtain blocks that are not nearby // Prevent unnecessary attempts to obtain blocks that are not nearby
if (next.type === 'block' && !world.getNearbyBlockTypes(this.agent.bot).includes(next.source)) { if (next.type === 'block' && !world.getNearbyBlockTypes(this.agent.bot).includes(next.source) ||
next.type === 'hunt' && !world.getNearbyEntityTypes(this.agent.bot).includes(next.source)) {
next.fails += 1; next.fails += 1;
await new Promise((resolve) => setTimeout(resolve, 500)); await new Promise((resolve) => setTimeout(resolve, 500));
this.agent.bot.emit('idle'); this.agent.bot.emit('idle');

View file

@ -172,7 +172,9 @@ export function getItemAnimalSource(itemName) {
raw_mutton: 'sheep', raw_mutton: 'sheep',
raw_porkchop: 'pig', raw_porkchop: 'pig',
raw_rabbit: 'rabbit', raw_rabbit: 'rabbit',
raw_salmon: 'salmon' raw_salmon: 'salmon',
leather: 'cow',
wool: 'sheep'
}[itemName]; }[itemName];
} }