feat: add useful entities debug entry to F3
This commit is contained in:
parent
a3dcfed4d0
commit
794cafb1f6
3 changed files with 33 additions and 17 deletions
|
|
@ -237,6 +237,16 @@ export class Entities {
|
|||
return Object.values(this.entities).filter(entity => entity.visible).length
|
||||
}
|
||||
|
||||
getDebugString (): string {
|
||||
const totalEntities = Object.keys(this.entities).length
|
||||
const visibleEntities = this.entitiesRenderingCount
|
||||
|
||||
const playerEntities = Object.values(this.entities).filter(entity => entity.playerObject)
|
||||
const visiblePlayerEntities = playerEntities.filter(entity => entity.visible)
|
||||
|
||||
return `${visibleEntities}/${totalEntities} ${visiblePlayerEntities.length}/${playerEntities.length}`
|
||||
}
|
||||
|
||||
constructor (public worldRenderer: WorldRendererThree) {
|
||||
this.debugMode = 'none'
|
||||
this.onSkinUpdate = () => { }
|
||||
|
|
|
|||
|
|
@ -124,6 +124,9 @@ const createGraphicsBackend: GraphicsBackendLoader = (initOptions: GraphicsInitO
|
|||
if (worldRenderer) worldRenderer.renderingActive = rendering
|
||||
},
|
||||
getDebugOverlay: () => ({
|
||||
get entitiesString () {
|
||||
return worldRenderer?.entities.getDebugString()
|
||||
},
|
||||
}),
|
||||
updateCamera (pos: Vec3 | null, yaw: number, pitch: number) {
|
||||
worldRenderer?.setFirstPersonCamera(pos, yaw, pitch)
|
||||
|
|
|
|||
|
|
@ -73,28 +73,31 @@ const FullscreenTime = () => {
|
|||
if (topRightTimeDisplay === 'only-fullscreen' && !fullScreen) return null
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
position: 'fixed',
|
||||
top: 'env(safe-area-inset-top, 5px)',
|
||||
right: 'env(safe-area-inset-right, 5px)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '4px',
|
||||
padding: '1px 3px',
|
||||
background: 'rgba(0, 0, 0, 0.75)',
|
||||
borderRadius: '2px',
|
||||
fontSize: 8,
|
||||
color: 'white',
|
||||
fontFamily: 'minecraft, mojangles, monospace',
|
||||
zIndex: 1,
|
||||
pointerEvents: 'none'
|
||||
}}>
|
||||
<div
|
||||
className='top-right-time'
|
||||
style={{
|
||||
position: 'fixed',
|
||||
top: 'env(safe-area-inset-top, 5px)',
|
||||
right: 'env(safe-area-inset-right, 5px)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '4px',
|
||||
padding: '1px 3px',
|
||||
background: 'rgba(0, 0, 0, 0.75)',
|
||||
borderRadius: '2px',
|
||||
fontSize: 8,
|
||||
color: 'white',
|
||||
fontFamily: 'minecraft, mojangles, monospace',
|
||||
zIndex: 1,
|
||||
pointerEvents: 'none'
|
||||
}}
|
||||
>
|
||||
<span>{time}</span>
|
||||
{batteryInfo && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '2px' }}>
|
||||
<PixelartIcon
|
||||
iconName={getBatteryIcon(batteryInfo.level, batteryInfo.charging)}
|
||||
styles={{ fontSize: 12 }}
|
||||
styles={{ fontSize: 10 }}
|
||||
/>
|
||||
<span>{batteryInfo.level}%</span>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue