diff --git a/src/agent/modes.js b/src/agent/modes.js index 0081682..56ecbf3 100644 --- a/src/agent/modes.js +++ b/src/agent/modes.js @@ -70,7 +70,7 @@ const modes = [ on: true, active: false, update: async function (agent) { - const enemy = world.getNearestEntityWhere(agent.bot, entity => mc.isHostile(entity), 16); + const enemy = world.getNearestEntityWhere(agent.bot, entity => mc.isHostile(entity), 8); if (enemy && await world.isClearPath(agent.bot, enemy)) { agent.bot.chat(`Aaa! A ${enemy.name}!`); execute(this, agent, async () => { @@ -86,11 +86,11 @@ const modes = [ on: true, active: false, update: async function (agent) { - const enemy = world.getNearestEntityWhere(agent.bot, entity => mc.isHostile(entity), 9); + const enemy = world.getNearestEntityWhere(agent.bot, entity => mc.isHostile(entity), 8); if (enemy && await world.isClearPath(agent.bot, enemy)) { agent.bot.chat(`Fighting ${enemy.name}!`); execute(this, agent, async () => { - await skills.defendSelf(agent.bot, 9); + await skills.defendSelf(agent.bot, 8); }); } } @@ -155,9 +155,12 @@ const modes = [ if (torches.length > 0) { const torch = torches[0]; const pos = agent.bot.entity.position; - execute(this, agent, async () => { - await skills.placeBlock(agent.bot, torch.name, pos.x, pos.y, pos.z); - }); + const curr_block = agent.bot.blockAt(pos); + if (curr_block.name === 'air') { + execute(this, agent, async () => { + await skills.placeBlock(agent.bot, torch.name, pos.x, pos.y, pos.z); + }); + } } } } diff --git a/src/utils/mcdata.js b/src/utils/mcdata.js index eeeb957..384a211 100644 --- a/src/utils/mcdata.js +++ b/src/utils/mcdata.js @@ -68,7 +68,7 @@ export function initBot(username) { export function isHuntable(mob) { if (!mob || !mob.name) return false; - const animals = ['chicken', 'cod', 'cow', 'llama', 'mooshroom', 'pig', 'pufferfish', 'rabbit', 'salmon', 'sheep', 'squid', 'tropical_fish', 'turtle']; + const animals = ['chicken', 'cow', 'llama', 'mooshroom', 'pig', 'rabbit', 'sheep']; return animals.includes(mob.name.toLowerCase()) && !mob.metadata[16]; // metadata 16 is not baby }