@zardoy/flying-squid 0.0.122 → 0.0.124

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.
Files changed (43) hide show
  1. package/config/default-settings.json +2 -4
  2. package/dist/app.js +18 -0
  3. package/dist/index.js +1 -1
  4. package/dist/lib/generations.d.ts +1 -1
  5. package/dist/lib/generations.js +2 -2
  6. package/dist/lib/modules/dimensionCodec.d.ts +2 -0
  7. package/dist/lib/modules/dimensionCodec.js +121 -0
  8. package/dist/lib/modules/effects.js +3 -0
  9. package/dist/lib/modules/index.js +3 -1
  10. package/dist/lib/modules/playerLogin.js +3 -2
  11. package/dist/lib/modules/players.d.ts +6 -0
  12. package/dist/lib/modules/players.js +42 -16
  13. package/dist/lib/modules/players.test.d.ts +1 -0
  14. package/dist/lib/modules/players.test.js +30 -0
  15. package/dist/lib/modules/portal.d.ts +5 -0
  16. package/dist/lib/modules/portal.js +179 -0
  17. package/dist/lib/modules/recipes.d.ts +12 -0
  18. package/dist/lib/modules/recipes.js +266 -0
  19. package/dist/lib/modules/title.d.ts +4 -2
  20. package/dist/lib/modules/title.js +33 -16
  21. package/dist/lib/modules/title.test.d.ts +1 -0
  22. package/dist/lib/modules/title.test.js +102 -0
  23. package/dist/lib/modules/world.d.ts +36 -3
  24. package/dist/lib/modules/world.js +259 -46
  25. package/dist/lib/modules/worldManager.d.ts +1 -0
  26. package/dist/lib/modules/worldManager.js +119 -0
  27. package/dist/lib/playerDat.d.ts +1 -8
  28. package/dist/lib/playerDat.js +13 -2
  29. package/dist/lib/worldGenerations/biomeFix.d.ts +10 -0
  30. package/dist/lib/worldGenerations/biomeFix.js +19 -0
  31. package/dist/lib/worldGenerations/empty.js +4 -1
  32. package/dist/lib/worldGenerations/noise.d.ts +22 -0
  33. package/dist/lib/worldGenerations/noise.js +248 -0
  34. package/dist/lib/worldGenerations/template.js +19 -5
  35. package/dist/lib/worldGenerations/templateExamples.d.ts +22 -0
  36. package/dist/lib/worldGenerations/templateExamples.js +279 -0
  37. package/dist/minigames/oneblock.d.ts +1 -0
  38. package/dist/minigames/oneblock.js +41 -0
  39. package/dist/minigames/tntRun.d.ts +1 -0
  40. package/dist/minigames/tntRun.js +14 -0
  41. package/dist/modules.d.ts +14 -7
  42. package/dist/types.d.ts +2 -0
  43. package/package.json +2 -2
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.minigame = void 0;
4
+ const vec3_1 = require("vec3");
5
+ const randomBlocksByEra = {
6
+ wood: ['dirt', 'oak_planks', 'spruce_planks', 'birch_planks', 'jungle_planks', 'acacia_planks', 'dark_oak_planks'],
7
+ mining: ['stone', 'iron_ore', 'granite', 'redstone_ore', 'diamond_ore', 'coal_ore'],
8
+ };
9
+ const minigame = (server) => {
10
+ server.spawnPoint = new vec3_1.Vec3(0, 1, 0);
11
+ const setBlock = (player) => {
12
+ const world = player.world;
13
+ const position = new vec3_1.Vec3(0, 0, 0);
14
+ const column = world.getLoadedColumn(0, 0);
15
+ if (!column)
16
+ return;
17
+ let block = column.getBlock(position);
18
+ while (!block) {
19
+ try {
20
+ const allBlockNames = Object.keys(randomBlocksByEra).flatMap(era => randomBlocksByEra[era]);
21
+ const blockName = allBlockNames[Math.floor(Math.random() * allBlockNames.length)];
22
+ block = server.PrismarineBlock.fromStateId(server.mcData.blocksByName[blockName].defaultState, 0);
23
+ }
24
+ catch (error) {
25
+ console.error(error);
26
+ }
27
+ }
28
+ world.setBlock(position, block);
29
+ };
30
+ server.on('newPlayer', (player) => {
31
+ // if player's inventory is empty give an iron pickaxe
32
+ if (player.inventory.slots.length === 0) {
33
+ server.handleCommand(`give ${player.name} iron_pickaxe 1`);
34
+ }
35
+ setBlock(player);
36
+ player.on('dug_done', () => {
37
+ setBlock(player);
38
+ });
39
+ });
40
+ };
41
+ exports.minigame = minigame;
@@ -0,0 +1 @@
1
+ export declare const minigame: (server: Server) => void;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.minigame = void 0;
4
+ const vec3_1 = require("vec3");
5
+ const minigame = (server) => {
6
+ server.spawnPoint = new vec3_1.Vec3(1, 1, 0);
7
+ server.on('newPlayer', (player) => {
8
+ // if player's inventory is empty give a TNT
9
+ if (player.inventory.slots.length === 0) {
10
+ server.handleCommand(`give ${player.name} tnt 1`);
11
+ }
12
+ });
13
+ };
14
+ exports.minigame = minigame;
package/dist/modules.d.ts CHANGED
@@ -40,7 +40,7 @@ declare global {
40
40
  newEntity: (entity: Entity) => void;
41
41
  tick: (delta: number, tickCount: number) => void;
42
42
  /** Emit seed once the world is loaded */
43
- seed: (seed: number) => void;
43
+ seed: (seed: number | bigint) => void;
44
44
  warpsLoaded: () => void;
45
45
  }
46
46
  interface Server extends TypedEmitter<ServerEvents> {
@@ -85,7 +85,7 @@ declare global {
85
85
  options: {
86
86
  worldHeight?: number;
87
87
  minY?: number;
88
- seed?: number;
88
+ seed?: string | number | bigint;
89
89
  version?: string;
90
90
  };
91
91
  };
@@ -93,10 +93,17 @@ declare global {
93
93
  * If provided, this encoded string completely replaces the normal chunk
94
94
  * generator for the overworld. Every chunk is filled from the decoded
95
95
  * structure; chunks outside the structure bounds are empty (air + sky
96
- * light).
96
+ * light). Player spawn is forced to a fixed point on top of the
97
+ * template (see `getTemplateSpawnPoint`).
97
98
  *
98
- * Strict format:
99
- * Y<n>: row0 | row1 | … | rowN-1 Y<n>: …
99
+ * **Built-in examples** — pass `"[name]"` to load one of the bundled
100
+ * templates.
101
+ * - Builds: `[castle]`, `[pyramid]`, `[rocket]`, `[lighthouse]`,
102
+ * `[skyscraper]`, `[pirate_ship]`
103
+ * - Map starters: `[skyblock]`, `[void_platform]`, `[one_block]`
104
+ *
105
+ * **Custom format** — strict layer encoding:
106
+ * `Y<n>: row0 | row1 | … | rowN-1 Y<n>: …`
100
107
  *
101
108
  * - `<n>` is a 0-based floor index (Y0 = ground, Y1 = one block up, …).
102
109
  * - Rows are separated by `|`; each row is one Z-slice of the floor.
@@ -105,8 +112,8 @@ declare global {
105
112
  * - Single characters map to block names via `blockMap` (see below).
106
113
  * - Width and depth are inferred from the decoded row lengths.
107
114
  *
108
- * @example
109
- * "Y0: 16C | 16C Y1: C14AC | C14AC"
115
+ * @example "[skyblock]"
116
+ * @example "Y0: 16C | 16C Y1: C14AC | C14AC"
110
117
  */
111
118
  chunkTemplate?: string;
112
119
  /**
package/dist/types.d.ts CHANGED
@@ -43,6 +43,7 @@ import "./lib/modules/players.d.ts"
43
43
  import "./lib/modules/pluginsFolder.d.ts"
44
44
  import "./lib/modules/portal.d.ts"
45
45
  import "./lib/modules/pvp.d.ts"
46
+ import "./lib/modules/recipes.d.ts"
46
47
  import "./lib/modules/redstone.d.ts"
47
48
  import "./lib/modules/resourcePack.d.ts"
48
49
  import "./lib/modules/respawn.d.ts"
@@ -63,3 +64,4 @@ import "./lib/modules/utils.d.ts"
63
64
  import "./lib/modules/warps.d.ts"
64
65
  import "./lib/modules/weather.d.ts"
65
66
  import "./lib/modules/world.d.ts"
67
+ import "./lib/modules/worldManager.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.122",
4
+ "version": "0.0.124",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": "dist/app.js",
@@ -24,11 +24,11 @@
24
24
  "@tootallnate/once": "2.0.0",
25
25
  "chalk": "^5.3.0",
26
26
  "change-case": "^4.1.2",
27
- "diamond-square": "github:zardoy/diamond-square",
28
27
  "exit-hook": "^2.2.1",
29
28
  "flatmap": "^0.0.3",
30
29
  "long": "^5.1.0",
31
30
  "mc-bridge": "^0.1.1",
31
+ "minecraft-worldgen": "^0.1.0",
32
32
  "minecraft-data": "^3.95.0",
33
33
  "minecraft-protocol": "^1.60.1",
34
34
  "mkdirp": "^2.1.3",