mode fixes

This commit is contained in:
Kolby Nottingham 2024-05-01 12:19:42 -07:00
parent 1a148c0222
commit 51f401e62d
2 changed files with 10 additions and 7 deletions

View file

@ -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,12 +155,15 @@ const modes = [
if (torches.length > 0) {
const torch = torches[0];
const pos = agent.bot.entity.position;
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);
});
}
}
}
}
},
{
name: 'idle_staring',

View file

@ -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
}