Skip to content

Commit

Permalink
Update world.js
Browse files Browse the repository at this point in the history
Chunk persistence when restarting the server.

Step:
- Turn on the server by creating a new map.
- Turn off the server.
- DO NOT ENTER THE GAME.
- Turn it back on.
- Enter the game.
  • Loading branch information
FabioSmuu authored Nov 23, 2024
1 parent a46804d commit 3416217
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/lib/plugins/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ module.exports.player = function (player, serv, settings) {
z: chunkZ,
chunk: column
}, ({ x, z, chunk }) => {
/*
Returning undefined for **sectionMask** as done in the **getMask** method of Prismarine-Chunk 1.18
*/

let mask
if (typeof column.sectionMask == 'object') {
mask = chunk.getMask()
}

player._client.write('map_chunk', {
x,
z,
Expand All @@ -198,6 +207,12 @@ module.exports.player = function (player, serv, settings) {
chunkData: chunk.dump(),
blockEntities: []
})

/*
Temporary fix for dumpLings
*/
if (typeof chunk.skyLightMask == 'object') return Promise.resolve()

if (registry.supportFeature('dimensionDataIsAvailable')) {
player._client.write('update_light', {
chunkX: x,
Expand Down Expand Up @@ -248,7 +263,12 @@ module.exports.player = function (player, serv, settings) {
.reduce((acc, { chunkX, chunkZ }) => {
const p = acc
.then(() => player.world.getColumn(chunkX, chunkZ))
.then((column) => player.sendChunk(chunkX, chunkZ, column))
.then((column) => {
/*
Temporary fix for dumpLings
*/
if (typeof column.skyLightMask == 'object') return player.sendChunk(chunkX, chunkZ, column)
})
return group ? p.then(() => sleep(5)) : p
}
, Promise.resolve())
Expand Down

0 comments on commit 3416217

Please sign in to comment.