@zardoy/flying-squid 0.0.132 → 0.0.133
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.
- package/dist/lib/entityPhysics.d.ts +48 -0
- package/dist/lib/entityPhysics.js +178 -0
- package/dist/lib/modules/daycycle.d.ts +7 -0
- package/dist/lib/modules/daycycle.js +16 -5
- package/dist/lib/modules/endFight.d.ts +17 -0
- package/dist/lib/modules/endFight.js +298 -0
- package/dist/lib/modules/entities.js +7 -8
- package/dist/lib/modules/index.js +4 -0
- package/dist/lib/modules/mobs.d.ts +86 -0
- package/dist/lib/modules/mobs.js +456 -0
- package/dist/lib/modules/physics.d.ts +7 -1
- package/dist/lib/modules/physics.js +18 -48
- package/dist/lib/modules/playerLogin.js +1 -4
- package/dist/lib/modules/portal.js +7 -3
- package/dist/lib/modules/projectiles.d.ts +22 -0
- package/dist/lib/modules/projectiles.js +334 -0
- package/dist/lib/modules/pvp.d.ts +4 -1
- package/dist/lib/modules/pvp.js +25 -6
- package/dist/lib/modules/spawners.d.ts +9 -0
- package/dist/lib/modules/spawners.js +114 -0
- package/dist/lib/modules/updatePositions.d.ts +2 -0
- package/dist/lib/modules/updatePositions.js +26 -2
- package/dist/lib/modules/world.d.ts +2 -0
- package/dist/lib/modules/world.js +3 -0
- package/dist/lib/worldGenerations/noise.d.ts +1 -0
- package/dist/lib/worldGenerations/noise.js +25 -2
- package/dist/types.d.ts +4 -0
- package/package.json +2 -2
|
@@ -19,6 +19,8 @@ export interface WorldSpec {
|
|
|
19
19
|
options?: Record<string, any>;
|
|
20
20
|
}
|
|
21
21
|
export interface CustomWorld extends World {
|
|
22
|
+
/** block positions (x, z) of the strongholds of this world, `limit` = first rings only (noise generator, overworld) */
|
|
23
|
+
strongholds?: (limit?: number) => Promise<Array<[number, number]>>;
|
|
22
24
|
/** releases the chunk generator (worker side caches) */
|
|
23
25
|
disposeGenerator?: () => Promise<void>;
|
|
24
26
|
blockEntityData: Record<string, any>;
|
|
@@ -224,6 +224,7 @@ const server = async function (serv, options) {
|
|
|
224
224
|
}, regionFolder === undefined || !Anvil ? null : new Anvil(regionFolder), options.savingInterval);
|
|
225
225
|
serv.overworld.seed = serv.seed = generationOptions.seed;
|
|
226
226
|
serv.overworld.generatorName = generation.name;
|
|
227
|
+
serv.overworld.strongholds = originalGenerator.strongholds;
|
|
227
228
|
patchWorld(serv.overworld);
|
|
228
229
|
dedupeGetColumn(serv.overworld);
|
|
229
230
|
// ---- world registry (Multiverse-style): any number of worlds; each has an environment (= client dimension type) and a generator
|
|
@@ -330,6 +331,7 @@ const server = async function (serv, options) {
|
|
|
330
331
|
const world = new World(generator, storageFor(spec.name, environment, opts.minY, opts.worldHeight), options.savingInterval);
|
|
331
332
|
world['min_y'] = opts.minY;
|
|
332
333
|
world.disposeGenerator = generator?.dispose;
|
|
334
|
+
world.strongholds = generator?.strongholds;
|
|
333
335
|
world['height'] = opts.worldHeight;
|
|
334
336
|
dedupeGetColumn(world);
|
|
335
337
|
world.seed = worldSeed;
|
|
@@ -892,6 +894,7 @@ const player = function (player, serv, settings) {
|
|
|
892
894
|
// `player.spawnPoint` is the respawn point in the overworld: another world has its own standable entry point
|
|
893
895
|
player.position = opt.position ?? (world === serv.overworld || !serv.worldEntryPoint ? player.spawnPoint : await serv.worldEntryPoint(world, from, player.position));
|
|
894
896
|
player.sendSpawnPosition();
|
|
897
|
+
player.sendTime();
|
|
895
898
|
player.updateAndSpawn();
|
|
896
899
|
await player.sendMap();
|
|
897
900
|
player.sendSelfPosition(false);
|
|
@@ -227,19 +227,40 @@ function generation(options = {}) {
|
|
|
227
227
|
const flattened = registry.supportFeature?.('theFlattening') !== false;
|
|
228
228
|
chunk.blockEntities ??= {};
|
|
229
229
|
for (const be of data.blockEntities) {
|
|
230
|
-
if (
|
|
230
|
+
if (be.y < minY || be.y >= minY + worldHeight)
|
|
231
|
+
continue;
|
|
232
|
+
if (!be.lootTable && !be.spawnerEntity)
|
|
231
233
|
continue;
|
|
232
234
|
const name = be.id.replace(/^minecraft:/, '');
|
|
233
235
|
pos.set(be.x, be.y, be.z);
|
|
234
236
|
// the block of this version at the position has to be the container (blocks newer than the version are replaced by stone / air)
|
|
235
237
|
if (registry.blocksByStateId[chunk.getBlockStateId(pos)]?.name !== name)
|
|
236
238
|
continue;
|
|
237
|
-
const legacyId = { chest: 'Chest', dispenser: 'Trap' }[name];
|
|
239
|
+
const legacyId = { chest: 'Chest', dispenser: 'Trap', spawner: 'MobSpawner' }[name];
|
|
238
240
|
if (!flattened && !legacyId)
|
|
239
241
|
continue;
|
|
240
242
|
const wx = chunkX * 16 + be.x;
|
|
241
243
|
const wz = chunkZ * 16 + be.z;
|
|
242
244
|
const seed = BigInt.asUintN(64, be.lootSeed ?? 0n);
|
|
245
|
+
if (be.spawnerEntity) {
|
|
246
|
+
// BaseSpawner defaults: first spawn after 20 ticks, then every 200-800 ticks, up to 4 mobs within 4 blocks, active within 16 blocks
|
|
247
|
+
const mob = be.spawnerEntity;
|
|
248
|
+
chunk.blockEntities[`${wx},${be.y},${wz}`] = {
|
|
249
|
+
id: { type: 'string', value: flattened ? be.id : legacyId },
|
|
250
|
+
x: { type: 'int', value: wx },
|
|
251
|
+
y: { type: 'int', value: be.y },
|
|
252
|
+
z: { type: 'int', value: wz },
|
|
253
|
+
Delay: { type: 'short', value: 20 },
|
|
254
|
+
MinSpawnDelay: { type: 'short', value: 200 },
|
|
255
|
+
MaxSpawnDelay: { type: 'short', value: 800 },
|
|
256
|
+
SpawnCount: { type: 'short', value: 4 },
|
|
257
|
+
MaxNearbyEntities: { type: 'short', value: 6 },
|
|
258
|
+
RequiredPlayerRange: { type: 'short', value: 16 },
|
|
259
|
+
SpawnRange: { type: 'short', value: 4 },
|
|
260
|
+
SpawnData: { type: 'compound', value: { entity: { type: 'compound', value: { id: { type: 'string', value: mob } } } } }
|
|
261
|
+
};
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
243
264
|
chunk.blockEntities[`${wx},${be.y},${wz}`] = {
|
|
244
265
|
id: { type: 'string', value: flattened ? be.id : legacyId },
|
|
245
266
|
x: { type: 'int', value: wx },
|
|
@@ -278,6 +299,8 @@ function generation(options = {}) {
|
|
|
278
299
|
return chunk;
|
|
279
300
|
}
|
|
280
301
|
/** releases the worker generator (and the pool when it was the last user) */
|
|
302
|
+
/** block positions (x, z) of the strongholds (eyes of ender point to them); `limit`: only the first rings (nearest the origin first) */
|
|
303
|
+
generateChunk.strongholds = async (limit) => (dimension === 'overworld' ? (await getSource()).strongholds(limit) : []);
|
|
281
304
|
generateChunk.dispose = async () => { if (sourceP) {
|
|
282
305
|
const p = sourceP;
|
|
283
306
|
sourceP = undefined;
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import "./lib/modules/daycycle.d.ts"
|
|
|
19
19
|
import "./lib/modules/digging.d.ts"
|
|
20
20
|
import "./lib/modules/dimensionCodec.d.ts"
|
|
21
21
|
import "./lib/modules/effects.d.ts"
|
|
22
|
+
import "./lib/modules/endFight.d.ts"
|
|
22
23
|
import "./lib/modules/entities.d.ts"
|
|
23
24
|
import "./lib/modules/errorHandler.d.ts"
|
|
24
25
|
import "./lib/modules/experience.d.ts"
|
|
@@ -34,6 +35,7 @@ import "./lib/modules/inventory.d.ts"
|
|
|
34
35
|
import "./lib/modules/log.d.ts"
|
|
35
36
|
import "./lib/modules/logout.d.ts"
|
|
36
37
|
import "./lib/modules/maps.d.ts"
|
|
38
|
+
import "./lib/modules/mobs.d.ts"
|
|
37
39
|
import "./lib/modules/moderation.d.ts"
|
|
38
40
|
import "./lib/modules/particle.d.ts"
|
|
39
41
|
import "./lib/modules/physics.d.ts"
|
|
@@ -42,6 +44,7 @@ import "./lib/modules/playerLogin.d.ts"
|
|
|
42
44
|
import "./lib/modules/players.d.ts"
|
|
43
45
|
import "./lib/modules/pluginsFolder.d.ts"
|
|
44
46
|
import "./lib/modules/portal.d.ts"
|
|
47
|
+
import "./lib/modules/projectiles.d.ts"
|
|
45
48
|
import "./lib/modules/pvp.d.ts"
|
|
46
49
|
import "./lib/modules/recipes.d.ts"
|
|
47
50
|
import "./lib/modules/redstone.d.ts"
|
|
@@ -54,6 +57,7 @@ import "./lib/modules/signs.d.ts"
|
|
|
54
57
|
import "./lib/modules/smelting.d.ts"
|
|
55
58
|
import "./lib/modules/sound.d.ts"
|
|
56
59
|
import "./lib/modules/spawn.d.ts"
|
|
60
|
+
import "./lib/modules/spawners.d.ts"
|
|
57
61
|
import "./lib/modules/stats.d.ts"
|
|
58
62
|
import "./lib/modules/tabComplete.d.ts"
|
|
59
63
|
import "./lib/modules/tick.d.ts"
|
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.
|
|
4
|
+
"version": "0.0.133",
|
|
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.
|
|
31
|
+
"minecraft-worldgen": "^0.1.4",
|
|
32
32
|
"minecraft-data": "^3.95.0",
|
|
33
33
|
"minecraft-protocol": "^1.60.1",
|
|
34
34
|
"mkdirp": "^2.1.3",
|