@zardoy/flying-squid 0.0.125 → 0.0.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,8 @@ const DIMENSIONS = {
10
10
  const PRESET_SETTINGS = {
11
11
  default: 'minecraft:overworld', amplified: 'minecraft:amplified', large_biomes: 'minecraft:large_biomes', caves: 'minecraft:caves', floating_islands: 'minecraft:floating_islands'
12
12
  };
13
+ /** a light section of sky light 15 everywhere */
14
+ const FULL_SKY = new Uint8Array(2048).fill(0xff);
13
15
  /** Source version of the worldgen data / block names (all palette names are 26.3 names). */
14
16
  const SOURCE_VERSION = '26.3';
15
17
  /**
@@ -220,7 +222,20 @@ function generation(options = {}) {
220
222
  }
221
223
  }
222
224
  }
223
- // full-bright like the other generators: max sky + block light everywhere
225
+ // light computed by the generator (minecraft-worldgen >= the version with ChunkData.skyLight): sections of 2048 nibble bytes, from info.minY up
226
+ if (data.skyLight && data.blockLight && typeof chunk._loadSkyLightNibbles === 'function') {
227
+ const firstSection = info.minY >> 4;
228
+ const sections = Math.min(info.height, minY + worldHeight - info.minY) >> 4;
229
+ for (let s = Math.max(0, (minY - info.minY) >> 4); s < sections; s++) {
230
+ chunk._loadSkyLightNibbles(firstSection + s, data.skyLight.subarray(s * 2048, (s + 1) * 2048));
231
+ chunk._loadBlockLightNibbles(firstSection + s, data.blockLight.subarray(s * 2048, (s + 1) * 2048));
232
+ }
233
+ // the light section above the world (clients read it for the top faces): open sky
234
+ if (dimension === 'overworld')
235
+ chunk._loadSkyLightNibbles((minY + worldHeight) >> 4, FULL_SKY);
236
+ return chunk;
237
+ }
238
+ // an older generator without light: full-bright, max sky + block light everywhere
224
239
  for (let y = 0; y < worldHeight; y++) {
225
240
  pos.y = minY + y;
226
241
  for (let z = 0; z < 16; z++) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zardoy/flying-squid",
3
3
  "description": "A minecraft server written in TS",
4
- "version": "0.0.125",
4
+ "version": "0.0.126",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": "dist/app.js",
@@ -28,7 +28,7 @@
28
28
  "flatmap": "^0.0.3",
29
29
  "long": "^5.1.0",
30
30
  "mc-bridge": "^0.1.1",
31
- "minecraft-worldgen": "^0.1.0",
31
+ "minecraft-worldgen": "^0.1.2",
32
32
  "minecraft-data": "^3.95.0",
33
33
  "minecraft-protocol": "^1.60.1",
34
34
  "mkdirp": "^2.1.3",