mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-23 06:32:06 +02:00
mode fixes
This commit is contained in:
parent
1a148c0222
commit
51f401e62d
2 changed files with 10 additions and 7 deletions
|
@ -70,7 +70,7 @@ const modes = [
|
||||||
on: true,
|
on: true,
|
||||||
active: false,
|
active: false,
|
||||||
update: async function (agent) {
|
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)) {
|
if (enemy && await world.isClearPath(agent.bot, enemy)) {
|
||||||
agent.bot.chat(`Aaa! A ${enemy.name}!`);
|
agent.bot.chat(`Aaa! A ${enemy.name}!`);
|
||||||
execute(this, agent, async () => {
|
execute(this, agent, async () => {
|
||||||
|
@ -86,11 +86,11 @@ const modes = [
|
||||||
on: true,
|
on: true,
|
||||||
active: false,
|
active: false,
|
||||||
update: async function (agent) {
|
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)) {
|
if (enemy && await world.isClearPath(agent.bot, enemy)) {
|
||||||
agent.bot.chat(`Fighting ${enemy.name}!`);
|
agent.bot.chat(`Fighting ${enemy.name}!`);
|
||||||
execute(this, agent, async () => {
|
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) {
|
if (torches.length > 0) {
|
||||||
const torch = torches[0];
|
const torch = torches[0];
|
||||||
const pos = agent.bot.entity.position;
|
const pos = agent.bot.entity.position;
|
||||||
execute(this, agent, async () => {
|
const curr_block = agent.bot.blockAt(pos);
|
||||||
await skills.placeBlock(agent.bot, torch.name, pos.x, pos.y, pos.z);
|
if (curr_block.name === 'air') {
|
||||||
});
|
execute(this, agent, async () => {
|
||||||
|
await skills.placeBlock(agent.bot, torch.name, pos.x, pos.y, pos.z);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ export function initBot(username) {
|
||||||
|
|
||||||
export function isHuntable(mob) {
|
export function isHuntable(mob) {
|
||||||
if (!mob || !mob.name) return false;
|
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
|
return animals.includes(mob.name.toLowerCase()) && !mob.metadata[16]; // metadata 16 is not baby
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue