fix: revert smooth fps patch to fix render issues (regression)
fix: forcefully cleanup the scene from chunks with f3+a
This commit is contained in:
parent
fa68006246
commit
d2b59f5797
3 changed files with 33 additions and 15 deletions
|
|
@ -36,6 +36,7 @@ export class WorldRenderer {
|
|||
lastCamUpdate = 0
|
||||
droppedFpsPercentage = 0
|
||||
initialChunksLoad = true
|
||||
enableChunksLoadDelay = false
|
||||
|
||||
texturesVersion?: string
|
||||
|
||||
|
|
@ -66,19 +67,19 @@ export class WorldRenderer {
|
|||
const chunkCoords = data.key.split(',')
|
||||
if (!this.loadedChunks[chunkCoords[0] + ',' + chunkCoords[2]] || !data.geometry.positions.length || !this.active) return
|
||||
|
||||
if (!this.initialChunksLoad) {
|
||||
const newPromise = new Promise(resolve => {
|
||||
if (this.droppedFpsPercentage > 0.5) {
|
||||
setTimeout(resolve, 1000 / 50 * this.droppedFpsPercentage)
|
||||
} else {
|
||||
setTimeout(resolve)
|
||||
}
|
||||
})
|
||||
this.promisesQueue.push(newPromise)
|
||||
for (const promise of this.promisesQueue) {
|
||||
await promise
|
||||
}
|
||||
}
|
||||
// if (!this.initialChunksLoad && this.enableChunksLoadDelay) {
|
||||
// const newPromise = new Promise(resolve => {
|
||||
// if (this.droppedFpsPercentage > 0.5) {
|
||||
// setTimeout(resolve, 1000 / 50 * this.droppedFpsPercentage)
|
||||
// } else {
|
||||
// setTimeout(resolve)
|
||||
// }
|
||||
// })
|
||||
// this.promisesQueue.push(newPromise)
|
||||
// for (const promise of this.promisesQueue) {
|
||||
// await promise
|
||||
// }
|
||||
// }
|
||||
|
||||
const geometry = new THREE.BufferGeometry()
|
||||
geometry.setAttribute('position', new THREE.BufferAttribute(data.geometry.positions, 3))
|
||||
|
|
@ -95,6 +96,7 @@ export class WorldRenderer {
|
|||
const boxHelper = new THREE.BoxHelper(mesh, 0xffff00)
|
||||
boxHelper.name = 'helper'
|
||||
object.add(boxHelper)
|
||||
object.name = 'chunk'
|
||||
if (!this.showChunkBorders) {
|
||||
boxHelper.visible = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,17 @@ contro.on('trigger', ({ command }) => {
|
|||
openPlayerInventory()
|
||||
break
|
||||
case 'general.drop':
|
||||
if (bot.heldItem) bot.tossStack(bot.heldItem)
|
||||
// if (bot.heldItem/* && ctrl */) bot.tossStack(bot.heldItem)
|
||||
bot._client.write('block_dig', {
|
||||
'status': 4,
|
||||
'location': {
|
||||
'x': 0,
|
||||
'z': 0,
|
||||
'y': 0
|
||||
},
|
||||
'face': 0,
|
||||
sequence: 0
|
||||
})
|
||||
break
|
||||
case 'general.chat':
|
||||
document.getElementById('hud').shadowRoot.getElementById('chat').enableChat()
|
||||
|
|
@ -235,6 +245,12 @@ export const f3Keybinds = [
|
|||
for (const [x, z] of loadedChunks) {
|
||||
worldView!.unloadChunk({ x, z })
|
||||
}
|
||||
for (const child of viewer.scene.children) {
|
||||
if (child.name === 'chunk') { // should not happen
|
||||
viewer.scene.remove(child)
|
||||
console.warn('forcefully removed chunk from scene')
|
||||
}
|
||||
}
|
||||
if (localServer) {
|
||||
//@ts-expect-error not sure why it is private... maybe revisit api?
|
||||
localServer.players[0].world.columns = {}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export default ({ worldData, onGeneralAction, onWorldAction }: Props) => {
|
|||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', minWidth: 400 }}>
|
||||
<div>
|
||||
<Button ref={firstButton} disabled={!focusedWorld} onClick={() => onWorldAction('load', focusedWorld)}>LOAD WORLD</Button>
|
||||
<Button rootRef={firstButton} disabled={!focusedWorld} onClick={() => onWorldAction('load', focusedWorld)}>LOAD WORLD</Button>
|
||||
<Button onClick={() => onGeneralAction('create')}>Create New World</Button>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue