This commit is contained in:
parent
e7d8fc0e64
commit
eb08d3720b
2 changed files with 19 additions and 1 deletions
11
index.js
11
index.js
|
@ -282,6 +282,17 @@ async function connect (options) {
|
|||
viewer.camera.updateProjectionMatrix()
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
})
|
||||
|
||||
// TODO: Remove after #85 is done
|
||||
debugMenu.customEntries.hp = bot.health
|
||||
debugMenu.customEntries.food = bot.food
|
||||
debugMenu.customEntries.saturation = bot.foodSaturation
|
||||
|
||||
bot.on('health', () => {
|
||||
debugMenu.customEntries.hp = bot.health
|
||||
debugMenu.customEntries.food = bot.food
|
||||
debugMenu.customEntries.saturation = bot.foodSaturation
|
||||
})
|
||||
})
|
||||
}
|
||||
main()
|
||||
|
|
|
@ -91,6 +91,12 @@ class DebugMenu extends LitElement {
|
|||
const minecraftYaw = viewDegToMinecraft(rot[0] * -180 / Math.PI)
|
||||
const minecraftQuad = Math.floor(((minecraftYaw + 180) / 90 + 0.5) % 4)
|
||||
|
||||
const renderProp = (name, value, nextItem) => {
|
||||
return html`${name}: ${typeof value === 'boolean'
|
||||
? html`<span style="color: ${value ? 'lightgreen' : 'red'}">${value}</span>`
|
||||
: value}${nextItem ? ' / ' : ''}`
|
||||
}
|
||||
|
||||
return html`
|
||||
<div id="debugmenu-wrapper" class="debugmenu-wrapper">
|
||||
<div class="debugmenu" id="debugmenu">
|
||||
|
@ -100,7 +106,8 @@ class DebugMenu extends LitElement {
|
|||
<p>Chunk: ${Math.floor(pos.x % 16)} ~ ${Math.floor(pos.z % 16)} in ${Math.floor(pos.x / 16)} ~ ${Math.floor(pos.z / 16)}</p>
|
||||
<p>Facing (viewer): ${rot[0].toFixed(3)} ${rot[1].toFixed(3)}</p>
|
||||
<p>Facing (minecraft): ${quadsDescription[minecraftQuad]} (${minecraftYaw.toFixed(1)} ${(rot[1] * -180 / Math.PI).toFixed(1)})</p>
|
||||
${targetDiggable ? html`<p>Looking at: ${target.position.x} ${target.position.y} ${target.position.z}</p>` : ''}<br>
|
||||
${targetDiggable ? html`<p>Looking at: ${target.position.x} ${target.position.y} ${target.position.z}</p>` : ''}
|
||||
${targetDiggable ? html`<p>${target.name} | ${Object.entries(target.getProperties()).map(([n, p], idx, arr) => renderProp(n, p, arr[idx + 1]))}</p>` : ''}<br>
|
||||
${Object.entries(this.customEntries).map(([name, value]) => html`<p>${name}: ${value}</p>`)}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue