diff --git a/src/agent/agent.js b/src/agent/agent.js index d821ecb..b6addf2 100644 --- a/src/agent/agent.js +++ b/src/agent/agent.js @@ -273,7 +273,14 @@ export class Agent { this.bot.on('messagestr', async (message, _, jsonMsg) => { if (jsonMsg.translate && jsonMsg.translate.startsWith('death') && message.startsWith(this.name)) { console.log('Agent died: ', message); - this.handleMessage('system', `You died with the final message: '${message}'. Previous actions were stopped and you have respawned. Notify the user and perform any necessary actions.`); + let death_pos = this.bot.entity.position; + this.memory_bank.rememberPlace('last_death_position', death_pos.x, death_pos.y, death_pos.z); + let death_pos_text = null; + if (death_pos) { + death_pos_text = `x: ${death_pos.x.toFixed(2)}, y: ${death_pos.y.toFixed(2)}, z: ${death_pos.x.toFixed(2)}`; + } + let dimention = this.bot.game.dimension; + this.handleMessage('system', `You died at position ${death_pos_text || "unknown"} in the ${dimention} dimension with the final message: '${message}'. Your place of death is saved as 'last_death_position' if you want to return. Previous actions were stopped and you have respawned.`); } }); this.bot.on('idle', () => { diff --git a/src/agent/modes.js b/src/agent/modes.js index f86603a..2c0b3e0 100644 --- a/src/agent/modes.js +++ b/src/agent/modes.js @@ -120,7 +120,7 @@ const modes = [ update: async function (agent) { const enemy = world.getNearestEntityWhere(agent.bot, entity => mc.isHostile(entity), 16); if (enemy && await world.isClearPath(agent.bot, enemy)) { - say(agent, `Aaa! A ${enemy.name}!`); + say(agent, `Aaa! A ${enemy.name.replace("_", " ")}!`); execute(this, agent, async () => { await skills.avoidEnemies(agent.bot, 24); });