@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.
- package/config/default-settings.json +2 -4
- package/dist/app.js +18 -0
- package/dist/index.js +1 -1
- package/dist/lib/generations.d.ts +1 -1
- package/dist/lib/generations.js +2 -2
- package/dist/lib/modules/dimensionCodec.d.ts +2 -0
- package/dist/lib/modules/dimensionCodec.js +121 -0
- package/dist/lib/modules/effects.js +3 -0
- package/dist/lib/modules/index.js +3 -1
- package/dist/lib/modules/playerLogin.js +3 -2
- package/dist/lib/modules/players.d.ts +6 -0
- package/dist/lib/modules/players.js +42 -16
- package/dist/lib/modules/players.test.d.ts +1 -0
- package/dist/lib/modules/players.test.js +30 -0
- package/dist/lib/modules/portal.d.ts +5 -0
- package/dist/lib/modules/portal.js +179 -0
- package/dist/lib/modules/recipes.d.ts +12 -0
- package/dist/lib/modules/recipes.js +266 -0
- package/dist/lib/modules/title.d.ts +4 -2
- package/dist/lib/modules/title.js +33 -16
- package/dist/lib/modules/title.test.d.ts +1 -0
- package/dist/lib/modules/title.test.js +102 -0
- package/dist/lib/modules/world.d.ts +36 -3
- package/dist/lib/modules/world.js +259 -46
- package/dist/lib/modules/worldManager.d.ts +1 -0
- package/dist/lib/modules/worldManager.js +119 -0
- package/dist/lib/playerDat.d.ts +1 -8
- package/dist/lib/playerDat.js +13 -2
- package/dist/lib/worldGenerations/biomeFix.d.ts +10 -0
- package/dist/lib/worldGenerations/biomeFix.js +19 -0
- package/dist/lib/worldGenerations/empty.js +4 -1
- package/dist/lib/worldGenerations/noise.d.ts +22 -0
- package/dist/lib/worldGenerations/noise.js +248 -0
- package/dist/lib/worldGenerations/template.js +19 -5
- package/dist/lib/worldGenerations/templateExamples.d.ts +22 -0
- package/dist/lib/worldGenerations/templateExamples.js +279 -0
- package/dist/minigames/oneblock.d.ts +1 -0
- package/dist/minigames/oneblock.js +41 -0
- package/dist/minigames/tntRun.d.ts +1 -0
- package/dist/minigames/tntRun.js +14 -0
- package/dist/modules.d.ts +14 -7
- package/dist/types.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
const { Vec3 } = require('vec3');
|
|
1
2
|
module.exports = (options) => {
|
|
2
3
|
const Chunk = require('prismarine-chunk')(options.version);
|
|
3
4
|
const mcData = require('minecraft-data')(options.version);
|
|
4
5
|
const stoneId = mcData.blocksByName.stone.id;
|
|
6
|
+
// 1.18+ columns can have a custom height range (nether / end: 0..256)
|
|
7
|
+
const chunkOptions = options.worldHeight !== undefined && options.minY !== undefined ? { minY: options.minY, worldHeight: options.worldHeight } : undefined;
|
|
5
8
|
return (chunkX, chunkZ) => {
|
|
6
|
-
const chunk = new Chunk();
|
|
9
|
+
const chunk = new Chunk(chunkOptions);
|
|
7
10
|
if (chunkX === 0 && chunkZ === 0) {
|
|
8
11
|
chunk.setBlockType(new Vec3(0, 64, 0), stoneId);
|
|
9
12
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minecraft 26.3 noise worldgen (`minecraft:noise`) chunk generator (package minecraft-worldgen); external worldgen datapacks are optional layers on top of the vanilla data.
|
|
3
|
+
*
|
|
4
|
+
* Options (on top of the usual `version`, `seed`, `minY`, `worldHeight`, `getRenamedData`):
|
|
5
|
+
* - `jars`: datapack jars in priority order, lowest first (default: vanilla client.jar + the external datapack jar, see
|
|
6
|
+
* `minecraft-worldgen` `src/data/registry.ts`).
|
|
7
|
+
* - `dimension`: `overworld` (default) | `nether` | `end`; selects the noise settings, the biome source and the chunk column size
|
|
8
|
+
* (overworld -64..320, nether / end 0..256 like their dimension types).
|
|
9
|
+
* - `preset` (overworld only): `default` | `amplified` | `large_biomes` | `caves` | `floating_islands` (vanilla noise settings of the same name).
|
|
10
|
+
* - `settings`: explicit noise settings id (overrides `dimension` / `preset`).
|
|
11
|
+
* - `recipe`: custom dimension, see minecraft-worldgen `src/recipe` and docs/worlds.md: a built-in name (`mining` | `islands` | `chaos`), `{ builtin, options }`,
|
|
12
|
+
* `{ script: '/path/recipe.js', options }` or a complete recipe object. A built-in recipe name is also accepted as `preset`.
|
|
13
|
+
* - `workers`: worker_threads used for generation (default min(4, cpus-1), env `MC_WORLDGEN_WORKERS`; 0 = in-process).
|
|
14
|
+
* - `workerFactory` (browser hosts): `(index) => new Worker(...)`; chunks are then generated in Web Workers (count: `workers`,
|
|
15
|
+
* default min(4, hardwareConcurrency-1)). The worker script is `minecraft-worldgen/dist/worker/web-entry` bundled by the host. The datapack zip
|
|
16
|
+
* URL(s) (`globalThis.__MC_WORLDGEN_DATAPACK_URL`: string, string[] or a function returning them) are passed to the workers, which fetch it themselves.
|
|
17
|
+
*/
|
|
18
|
+
declare function generation(options?: any): {
|
|
19
|
+
(chunkX: number, chunkZ: number): Promise<any>;
|
|
20
|
+
dispose(): Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
export = generation;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const vec3_1 = require("vec3");
|
|
3
|
+
const biomeFix_1 = require("./biomeFix");
|
|
4
|
+
const random_1 = require("minecraft-worldgen/dist/rng/random");
|
|
5
|
+
const builtin_1 = require("minecraft-worldgen/dist/recipe/builtin");
|
|
6
|
+
const pool_1 = require("minecraft-worldgen/dist/worker/pool");
|
|
7
|
+
const DIMENSIONS = {
|
|
8
|
+
overworld: { settings: 'minecraft:overworld' }, nether: { settings: 'minecraft:nether' }, end: { settings: 'minecraft:end' }
|
|
9
|
+
};
|
|
10
|
+
const PRESET_SETTINGS = {
|
|
11
|
+
default: 'minecraft:overworld', amplified: 'minecraft:amplified', large_biomes: 'minecraft:large_biomes', caves: 'minecraft:caves', floating_islands: 'minecraft:floating_islands'
|
|
12
|
+
};
|
|
13
|
+
/** Source version of the worldgen data / block names (all palette names are 26.3 names). */
|
|
14
|
+
const SOURCE_VERSION = '26.3';
|
|
15
|
+
/**
|
|
16
|
+
* Minecraft 26.3 noise worldgen (`minecraft:noise`) chunk generator (package minecraft-worldgen); external worldgen datapacks are optional layers on top of the vanilla data.
|
|
17
|
+
*
|
|
18
|
+
* Options (on top of the usual `version`, `seed`, `minY`, `worldHeight`, `getRenamedData`):
|
|
19
|
+
* - `jars`: datapack jars in priority order, lowest first (default: vanilla client.jar + the external datapack jar, see
|
|
20
|
+
* `minecraft-worldgen` `src/data/registry.ts`).
|
|
21
|
+
* - `dimension`: `overworld` (default) | `nether` | `end`; selects the noise settings, the biome source and the chunk column size
|
|
22
|
+
* (overworld -64..320, nether / end 0..256 like their dimension types).
|
|
23
|
+
* - `preset` (overworld only): `default` | `amplified` | `large_biomes` | `caves` | `floating_islands` (vanilla noise settings of the same name).
|
|
24
|
+
* - `settings`: explicit noise settings id (overrides `dimension` / `preset`).
|
|
25
|
+
* - `recipe`: custom dimension, see minecraft-worldgen `src/recipe` and docs/worlds.md: a built-in name (`mining` | `islands` | `chaos`), `{ builtin, options }`,
|
|
26
|
+
* `{ script: '/path/recipe.js', options }` or a complete recipe object. A built-in recipe name is also accepted as `preset`.
|
|
27
|
+
* - `workers`: worker_threads used for generation (default min(4, cpus-1), env `MC_WORLDGEN_WORKERS`; 0 = in-process).
|
|
28
|
+
* - `workerFactory` (browser hosts): `(index) => new Worker(...)`; chunks are then generated in Web Workers (count: `workers`,
|
|
29
|
+
* default min(4, hardwareConcurrency-1)). The worker script is `minecraft-worldgen/dist/worker/web-entry` bundled by the host. The datapack zip
|
|
30
|
+
* URL(s) (`globalThis.__MC_WORLDGEN_DATAPACK_URL`: string, string[] or a function returning them) are passed to the workers, which fetch it themselves.
|
|
31
|
+
*/
|
|
32
|
+
function generation(options = {}) {
|
|
33
|
+
const { version, getRenamedData } = options;
|
|
34
|
+
const dimension = options.dimension ?? 'overworld';
|
|
35
|
+
if (!DIMENSIONS[dimension])
|
|
36
|
+
throw new Error(`noise generator: unknown dimension '${dimension}' (overworld | nether | end)`);
|
|
37
|
+
let preset = options.preset ?? 'default';
|
|
38
|
+
let recipe = typeof options.recipe === 'string' ? { builtin: options.recipe } : options.recipe;
|
|
39
|
+
if (!recipe && builtin_1.BUILTIN_RECIPES[preset]) {
|
|
40
|
+
recipe = { builtin: preset };
|
|
41
|
+
preset = 'default';
|
|
42
|
+
}
|
|
43
|
+
if (recipe && 'script' in recipe)
|
|
44
|
+
recipe = { ...recipe, script: require('path').resolve(recipe.script) };
|
|
45
|
+
if (!recipe && dimension === 'overworld' && !PRESET_SETTINGS[preset])
|
|
46
|
+
throw new Error(`noise generator: unknown preset '${preset}' (${Object.keys(PRESET_SETTINGS).join(' | ')})`);
|
|
47
|
+
const settingsId = options.settings ?? (dimension === 'overworld' ? PRESET_SETTINGS[preset] : DIMENSIONS[dimension].settings);
|
|
48
|
+
// dimension type of the chunk column: overworld -64..320, nether / end 0..256
|
|
49
|
+
const minY = dimension === 'overworld' ? (options.minY ?? -64) : 0;
|
|
50
|
+
const worldHeight = dimension === 'overworld' ? (options.worldHeight ?? 384) : 256;
|
|
51
|
+
const Chunk = require('prismarine-chunk')(version);
|
|
52
|
+
const registry = require('prismarine-registry')(version);
|
|
53
|
+
const Block = require('prismarine-block')(registry);
|
|
54
|
+
if (dimension === 'overworld' && (minY !== -64 || worldHeight !== 384)) {
|
|
55
|
+
throw new Error(`noise generator needs a 384-block tall world starting at y=-64 (version >= 1.18), got minY=${minY} height=${worldHeight}`);
|
|
56
|
+
}
|
|
57
|
+
const seed = (0, random_1.parseWorldSeed)(options.seed);
|
|
58
|
+
const workers = options.workers;
|
|
59
|
+
const workerFactory = options.workerFactory;
|
|
60
|
+
const createSource = () => (async () => {
|
|
61
|
+
let zipBuffers = options.zipBuffers;
|
|
62
|
+
if (!zipBuffers && !options.jars) {
|
|
63
|
+
// one URL or several (lowest priority first: vanilla pack, then e.g. a datapack the player loaded)
|
|
64
|
+
let global = globalThis.__MC_WORLDGEN_DATAPACK_URL;
|
|
65
|
+
if (typeof global === 'function')
|
|
66
|
+
global = await global();
|
|
67
|
+
const urls = global === undefined ? undefined : Array.isArray(global) ? global : [global];
|
|
68
|
+
if (urls?.length && workerFactory && workers !== 0) {
|
|
69
|
+
// Web Workers fetch the (HTTP-cached / data: / blob:) datapack themselves instead of receiving a copy each
|
|
70
|
+
return (0, pool_1.createChunkSource)({ seed: seed.toString(), datapackUrl: urls.length === 1 ? urls[0] : urls, settings: settingsId, recipe, maxCachedChunks: options.maxCachedChunks ?? 160 }, workers, workerFactory);
|
|
71
|
+
}
|
|
72
|
+
if (urls?.length) {
|
|
73
|
+
zipBuffers = await Promise.all(urls.map(async (url, i) => {
|
|
74
|
+
const res = await fetch(url);
|
|
75
|
+
if (!res.ok)
|
|
76
|
+
throw new Error(`worldgen datapack fetch failed ${res.status}: ${url}`);
|
|
77
|
+
return { name: `datapack${i}.zip`, data: new Uint8Array(await res.arrayBuffer()) };
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return (0, pool_1.createChunkSource)({ seed: seed.toString(), jars: options.jars, zipBuffers, settings: settingsId, recipe }, workers, workerFactory);
|
|
82
|
+
})();
|
|
83
|
+
// created lazily: a dimension nobody visits does not start a worker pool
|
|
84
|
+
let sourceP;
|
|
85
|
+
const getSource = () => {
|
|
86
|
+
if (!sourceP) {
|
|
87
|
+
sourceP = createSource();
|
|
88
|
+
sourceP.catch(() => { });
|
|
89
|
+
} // failures surface through generateChunk
|
|
90
|
+
return sourceP;
|
|
91
|
+
};
|
|
92
|
+
// ------------------------------------------------------------------ block-state mapping (26.3 -> client version)
|
|
93
|
+
const warned = new Set();
|
|
94
|
+
const stateByName = new Map();
|
|
95
|
+
const fallbackStone = registry.blocksByName.stone.defaultState ?? registry.blocksByName.stone.minStateId;
|
|
96
|
+
// blocks newer than the client version: aliases first, then a category fallback (plants / decoration -> air, other unknown blocks -> stone)
|
|
97
|
+
const ALIASES = {
|
|
98
|
+
short_grass: 'grass', tall_dry_grass: 'dead_bush', short_dry_grass: 'dead_bush', dead_bush: 'dead_bush',
|
|
99
|
+
cherry_leaves: 'flowering_azalea_leaves', pale_oak_leaves: 'dark_oak_leaves', mangrove_leaves: 'jungle_leaves',
|
|
100
|
+
cherry_log: 'acacia_log', pale_oak_log: 'dark_oak_log', mangrove_log: 'jungle_log', mangrove_roots: 'oak_log', pale_moss_block: 'moss_block', pale_moss_carpet: 'moss_carpet',
|
|
101
|
+
resin_block: 'orange_terracotta', creaking_heart: 'dark_oak_log', pale_hanging_moss: 'air'
|
|
102
|
+
};
|
|
103
|
+
const PLANTISH = /(^|_)(grass|bush|flowers?|litter|mushroom|fern|vines?|petals|sprouts?|roots|sapling|tulip|dandelion|poppy|orchid|allium|azure_bluet|cornflower|lily|peony|lilac|rose|dripleaf|hanging_moss|wildflowers|firefly|sweet_berry|torchflower|pitcher|eyeblossom|cactus_flower|dry_grass)(_|$)/;
|
|
104
|
+
const woodSuffix = /_(log|wood|planks|slab|stairs|fence|fence_gate|door|trapdoor|button|pressure_plate|sign|leaves)$/;
|
|
105
|
+
const resolveBlock = (base) => {
|
|
106
|
+
const direct = registry.blocksByName[base];
|
|
107
|
+
if (direct)
|
|
108
|
+
return direct;
|
|
109
|
+
const alias = ALIASES[base];
|
|
110
|
+
if (alias && registry.blocksByName[alias])
|
|
111
|
+
return registry.blocksByName[alias];
|
|
112
|
+
if (alias === 'air' || PLANTISH.test(base))
|
|
113
|
+
return registry.blocksByName.air;
|
|
114
|
+
const m = woodSuffix.exec(base);
|
|
115
|
+
if (m && registry.blocksByName['oak' + m[0]])
|
|
116
|
+
return registry.blocksByName['oak' + m[0]];
|
|
117
|
+
return undefined;
|
|
118
|
+
};
|
|
119
|
+
const mapState = (state) => {
|
|
120
|
+
const m = /^(?:minecraft:)?([^[]+)(?:\[(.*)\])?$/.exec(state);
|
|
121
|
+
const base = m[1];
|
|
122
|
+
const props = {};
|
|
123
|
+
if (m[2])
|
|
124
|
+
for (const kv of m[2].split(',')) {
|
|
125
|
+
const [k, v] = kv.split('=');
|
|
126
|
+
props[k] = v;
|
|
127
|
+
}
|
|
128
|
+
const renamed = getRenamedData ? getRenamedData('blocks', base, SOURCE_VERSION, version) : base;
|
|
129
|
+
const block = resolveBlock(renamed) ?? resolveBlock(base);
|
|
130
|
+
if (!block) {
|
|
131
|
+
if (!warned.has(renamed)) {
|
|
132
|
+
warned.add(renamed);
|
|
133
|
+
console.warn(`[noise] block '${renamed}' (from ${state}) unknown in ${version}, using stone`);
|
|
134
|
+
}
|
|
135
|
+
return fallbackStone;
|
|
136
|
+
}
|
|
137
|
+
if (block.name === 'air')
|
|
138
|
+
return 0;
|
|
139
|
+
if (!block.states)
|
|
140
|
+
return block.defaultState ?? block.minStateId ?? block.id;
|
|
141
|
+
// the generator omits properties equal to the block's default state: start from the defaults (Block.fromProperties would take the first value of each property)
|
|
142
|
+
const known = new Set(block.states.map((s) => s.name));
|
|
143
|
+
const filtered = { ...defaultProps(block) };
|
|
144
|
+
for (const k of Object.keys(props))
|
|
145
|
+
if (known.has(k))
|
|
146
|
+
filtered[k] = props[k];
|
|
147
|
+
try {
|
|
148
|
+
return Block.fromProperties(block.name, filtered, 0).stateId;
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return block.defaultState ?? block.minStateId;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const defaultPropsCache = new Map();
|
|
155
|
+
const defaultProps = (block) => {
|
|
156
|
+
let d = defaultPropsCache.get(block.name);
|
|
157
|
+
if (!d) {
|
|
158
|
+
d = {};
|
|
159
|
+
try {
|
|
160
|
+
const props = Block.fromStateId(block.defaultState, 0).getProperties();
|
|
161
|
+
for (const [k, v] of Object.entries(props))
|
|
162
|
+
d[k] = String(v);
|
|
163
|
+
}
|
|
164
|
+
catch { }
|
|
165
|
+
defaultPropsCache.set(block.name, d);
|
|
166
|
+
}
|
|
167
|
+
return d;
|
|
168
|
+
};
|
|
169
|
+
const stateIdOfName = (name) => {
|
|
170
|
+
let s = stateByName.get(name);
|
|
171
|
+
if (s === undefined) {
|
|
172
|
+
s = mapState(name);
|
|
173
|
+
stateByName.set(name, s);
|
|
174
|
+
}
|
|
175
|
+
return s;
|
|
176
|
+
};
|
|
177
|
+
// ------------------------------------------------------------------ biome mapping (<datapack>:* -> vanilla client id)
|
|
178
|
+
const plains = registry.biomesByName.plains.id;
|
|
179
|
+
let biomeIds;
|
|
180
|
+
const biomeIdsFor = (info) => biomeIds ??= info.vanillaBiomes.map(v => {
|
|
181
|
+
const b = registry.biomesByName[v.replace(/^minecraft:/, '')];
|
|
182
|
+
return b ? b.id : plains;
|
|
183
|
+
});
|
|
184
|
+
const pos = new vec3_1.Vec3(0, 0, 0);
|
|
185
|
+
async function generateChunk(chunkX, chunkZ) {
|
|
186
|
+
const source = await getSource();
|
|
187
|
+
const data = await source.generate(chunkX, chunkZ);
|
|
188
|
+
const ids = biomeIdsFor(source.info);
|
|
189
|
+
const palette = new Int32Array(data.palette.length);
|
|
190
|
+
for (let i = 1; i < palette.length; i++)
|
|
191
|
+
palette[i] = stateIdOfName(data.palette[i]);
|
|
192
|
+
const chunk = (0, biomeFix_1.fixSetBiome)(new Chunk({ minY, worldHeight }));
|
|
193
|
+
const info = source.info;
|
|
194
|
+
const blocks = data.blocks;
|
|
195
|
+
const rows = Math.min(info.height, minY + worldHeight - info.minY);
|
|
196
|
+
for (let y = Math.max(0, minY - info.minY); y < rows; y++) {
|
|
197
|
+
pos.y = info.minY + y;
|
|
198
|
+
for (let z = 0; z < 16; z++) {
|
|
199
|
+
pos.z = z;
|
|
200
|
+
const row = (y * 16 + z) * 16;
|
|
201
|
+
for (let x = 0; x < 16; x++) {
|
|
202
|
+
const id = blocks[row + x];
|
|
203
|
+
if (id === 0)
|
|
204
|
+
continue;
|
|
205
|
+
pos.x = x;
|
|
206
|
+
chunk.setBlockStateId(pos, palette[id]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// biomes: quart resolution, absolute y; quart rows above/below the generated range repeat the nearest generated row
|
|
211
|
+
const biomes = data.biomes;
|
|
212
|
+
const qRows = info.height >> 2;
|
|
213
|
+
const baseQy = info.minY >> 2;
|
|
214
|
+
for (let qy = minY >> 2; qy < (minY + worldHeight) >> 2; qy++) {
|
|
215
|
+
const src = Math.min(Math.max(qy - baseQy, 0), qRows - 1);
|
|
216
|
+
for (let qz = 0; qz < 4; qz++) {
|
|
217
|
+
for (let qx = 0; qx < 4; qx++) {
|
|
218
|
+
pos.set(qx * 4, qy * 4, qz * 4);
|
|
219
|
+
chunk.setBiome(pos, ids[biomes[(src * 4 + qz) * 4 + qx]]);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// full-bright like the other generators: max sky + block light everywhere
|
|
224
|
+
for (let y = 0; y < worldHeight; y++) {
|
|
225
|
+
pos.y = minY + y;
|
|
226
|
+
for (let z = 0; z < 16; z++) {
|
|
227
|
+
pos.z = z;
|
|
228
|
+
for (let x = 0; x < 16; x++) {
|
|
229
|
+
pos.x = x;
|
|
230
|
+
chunk.setSkyLight(pos, 15);
|
|
231
|
+
chunk.setBlockLight(pos, 15);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return chunk;
|
|
236
|
+
}
|
|
237
|
+
/** releases the worker generator (and the pool when it was the last user) */
|
|
238
|
+
generateChunk.dispose = async () => { if (sourceP) {
|
|
239
|
+
const p = sourceP;
|
|
240
|
+
sourceP = undefined;
|
|
241
|
+
try {
|
|
242
|
+
await (await p).close();
|
|
243
|
+
}
|
|
244
|
+
catch { }
|
|
245
|
+
} };
|
|
246
|
+
return generateChunk;
|
|
247
|
+
}
|
|
248
|
+
module.exports = generation;
|
|
@@ -7,6 +7,7 @@ exports.parseTemplate = parseTemplate;
|
|
|
7
7
|
exports.getTemplateSpawnPoint = getTemplateSpawnPoint;
|
|
8
8
|
exports.makeTemplateGenerator = makeTemplateGenerator;
|
|
9
9
|
const vec3_1 = require("vec3");
|
|
10
|
+
const templateExamples_1 = require("./templateExamples");
|
|
10
11
|
/**
|
|
11
12
|
* Default single-character → Minecraft block-name mapping used by the
|
|
12
13
|
* chunk-template generator. Users can override any entry (or add new ones)
|
|
@@ -39,6 +40,13 @@ exports.DEFAULT_BLOCK_MAP = {
|
|
|
39
40
|
Q: 'quartz_block',
|
|
40
41
|
U: 'sea_lantern',
|
|
41
42
|
V: 'stone_slab',
|
|
43
|
+
// Lowercase additions — natural / map-starter blocks
|
|
44
|
+
g: 'grass_block',
|
|
45
|
+
l: 'oak_leaves',
|
|
46
|
+
c: 'chest',
|
|
47
|
+
w: 'water',
|
|
48
|
+
v: 'lava',
|
|
49
|
+
s: 'sand',
|
|
42
50
|
};
|
|
43
51
|
// ---------------------------------------------------------------------------
|
|
44
52
|
// Block-map parser
|
|
@@ -162,6 +170,8 @@ function makeTemplateGenerator(templateStr, options, userBlockMap) {
|
|
|
162
170
|
const Chunk = require('prismarine-chunk')(options.version);
|
|
163
171
|
const mcData = require('minecraft-data')(options.version);
|
|
164
172
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
173
|
+
// Resolve `[example_name]` shorthand to the full template string.
|
|
174
|
+
templateStr = (0, templateExamples_1.resolveTemplate)(templateStr);
|
|
165
175
|
const minY = options.minY ?? 0;
|
|
166
176
|
const worldHeight = options.worldHeight ?? 256;
|
|
167
177
|
const baseY = options.baseY ?? 64;
|
|
@@ -204,11 +214,15 @@ function makeTemplateGenerator(templateStr, options, userBlockMap) {
|
|
|
204
214
|
}
|
|
205
215
|
}
|
|
206
216
|
// Guarantee a solid block directly below the spawn position so the player
|
|
207
|
-
// always has something to land on
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
217
|
+
// always has something to land on, but defer to whatever the template
|
|
218
|
+
// intended at that exact cell (e.g. skyblock places grass there).
|
|
219
|
+
const spawnPlatformKey = `${SPAWN_OFFSET},${baseY},${SPAWN_OFFSET}`;
|
|
220
|
+
if (!blockGrid.has(spawnPlatformKey)) {
|
|
221
|
+
const spawnPlatformId = theFlattening
|
|
222
|
+
? mcData.blocksByName.stone.minStateId
|
|
223
|
+
: mcData.blocksByName.stone.id;
|
|
224
|
+
blockGrid.set(spawnPlatformKey, spawnPlatformId);
|
|
225
|
+
}
|
|
212
226
|
return (chunkX, chunkZ) => {
|
|
213
227
|
const chunk = new Chunk({ minY, worldHeight });
|
|
214
228
|
// Full sky-light (standard for surface/flat worlds)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in `chunkTemplate` examples. Reference one from config with:
|
|
3
|
+
*
|
|
4
|
+
* "chunkTemplate": "[castle]" // case-insensitive
|
|
5
|
+
* "chunkTemplate": "[pirate_ship]"
|
|
6
|
+
* "chunkTemplate": "[skyscraper]"
|
|
7
|
+
*
|
|
8
|
+
* Each template uses the strict `Y<n>: row | row | …` format documented on
|
|
9
|
+
* `parseTemplate`. All builds start at world Y `baseY` (default 64) and
|
|
10
|
+
* extend upward. Default `blockMap` is assumed (C=cobblestone, M=mossy,
|
|
11
|
+
* G=glass, R=red_wool, D=dark_oak_planks, I=iron_block, S=stone, B=bricks,
|
|
12
|
+
* W=oak_planks, Y=gold_block, T=stone_bricks, Q=quartz_block, H=sandstone,
|
|
13
|
+
* U=sea_lantern, F=oak_log, …).
|
|
14
|
+
*/
|
|
15
|
+
export declare const TEMPLATE_EXAMPLES: Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* If `templateStr` is exactly `[name]` (whitespace tolerated), return the
|
|
18
|
+
* matching built-in example; otherwise return `templateStr` unchanged.
|
|
19
|
+
*
|
|
20
|
+
* Throws when the example name is not registered.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveTemplate(templateStr: string): string;
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `chunkTemplate` examples. Reference one from config with:
|
|
4
|
+
*
|
|
5
|
+
* "chunkTemplate": "[castle]" // case-insensitive
|
|
6
|
+
* "chunkTemplate": "[pirate_ship]"
|
|
7
|
+
* "chunkTemplate": "[skyscraper]"
|
|
8
|
+
*
|
|
9
|
+
* Each template uses the strict `Y<n>: row | row | …` format documented on
|
|
10
|
+
* `parseTemplate`. All builds start at world Y `baseY` (default 64) and
|
|
11
|
+
* extend upward. Default `blockMap` is assumed (C=cobblestone, M=mossy,
|
|
12
|
+
* G=glass, R=red_wool, D=dark_oak_planks, I=iron_block, S=stone, B=bricks,
|
|
13
|
+
* W=oak_planks, Y=gold_block, T=stone_bricks, Q=quartz_block, H=sandstone,
|
|
14
|
+
* U=sea_lantern, F=oak_log, …).
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.TEMPLATE_EXAMPLES = void 0;
|
|
18
|
+
exports.resolveTemplate = resolveTemplate;
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// CASTLE — 16×16×16 Classic medieval keep with corner towers, gate, banners.
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
const CASTLE = `
|
|
23
|
+
Y0: 4C4M4C4M | 4M8C4M | 4C4M4C4M | 4M8C4M | 4C4M4C4M | 4M8C4M | 4C4M4C4M | 4M8C4M
|
|
24
|
+
| 4C4M4C4M | 4M8C4M | 4C4M4C4M | 4M8C4M | 4C4M4C4M | 4M8C4M | 4C4M4C4M | 4M8C4M
|
|
25
|
+
Y1: 16C | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC
|
|
26
|
+
| C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | 16C
|
|
27
|
+
Y2: 16C | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC
|
|
28
|
+
| C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | 16C
|
|
29
|
+
Y3: 16C | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC
|
|
30
|
+
| C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | 16C
|
|
31
|
+
Y4: 16C | C14AC | 6C4G6C | C14AC | C14AC | C14AC | C14AC | C14AC
|
|
32
|
+
| C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | 6C4G6C | 16C
|
|
33
|
+
Y5: 16C | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC
|
|
34
|
+
| C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | 16C
|
|
35
|
+
Y6: 16C | C14AC | 6C4G6C | C14AC | C14AC | C14AC | C14AC | C14AC
|
|
36
|
+
| C14AC | C14AC | C14AC | C14AC | C14AC | C14AC | 6C4G6C | 16C
|
|
37
|
+
Y7: CACACACACACACACA | C14AC | C14AC | C14AC | 16A | 16A | 16A | 16A
|
|
38
|
+
| 16A | 16A | 16A | 16A | C14AC | C14AC | C14AC | CACACACACACACACA
|
|
39
|
+
Y8: 4C8A4C | 4C8A4C | 4C8A4C | 4C8A4C | 8A8A | 8A8A | 8A8A | 8A8A
|
|
40
|
+
| 8A8A | 8A8A | 8A8A | 8A8A | 4C8A4C | 4C8A4C | 4C8A4C | 4C8A4C
|
|
41
|
+
Y9: 4C8A4C | C2AC8AC2AC | C2AC8AC2AC | 4C8A4C | 16A | 16A | 16A | 16A
|
|
42
|
+
| 16A | 16A | 16A | 16A | 4C8A4C | C2AC8AC2AC | C2AC8AC2AC | 4C8A4C
|
|
43
|
+
Y10: 4C8A4C | C2AC8AC2AC | C2AC8AC2AC | 4C8A4C | 16A | 16A | 16A | 16A
|
|
44
|
+
| 16A | 16A | 16A | 16A | 4C8A4C | C2AC8AC2AC | C2AC8AC2AC | 4C8A4C
|
|
45
|
+
Y11: 4C8A4C | CGC1AC8ACGC | CGC1AC8ACGC | 4C8A4C | 16A | 16A | 16A | 16A
|
|
46
|
+
| 16A | 16A | 16A | 16A | 4C8A4C | CGC1AC8ACGC | CGC1AC8ACGC | 4C8A4C
|
|
47
|
+
Y12: 4C8A4C | C2AC8AC2AC | C2AC8AC2AC | 4C8A4C | 16A | 16A | 16A | 16A
|
|
48
|
+
| 16A | 16A | 16A | 16A | 4C8A4C | C2AC8AC2AC | C2AC8AC2AC | 4C8A4C
|
|
49
|
+
Y13: CACA8ACACA | 4C8A4C | 4C8A4C | CACA8ACACA | 16A | 16A | 16A | 16A
|
|
50
|
+
| 16A | 16A | 16A | 16A | CACA8ACACA | 4C8A4C | 4C8A4C | CACA8ACACA
|
|
51
|
+
Y14: 4C8A4C | 4C8A4C | 4C8A4C | 4C8A4C | 16A | 16A | 16A | 16A
|
|
52
|
+
| 16A | 16A | 16A | 16A | 4C8A4C | 4C8A4C | 4C8A4C | 4C8A4C
|
|
53
|
+
Y15: CRCC8ACCRC | 4C8A4C | 4C8A4C | CRCC8ACCRC | 16A | 16A | 16A | 16A
|
|
54
|
+
| 16A | 16A | 16A | 16A | CRCC8ACCRC | 4C8A4C | 4C8A4C | CRCC8ACCRC
|
|
55
|
+
`;
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// PYRAMID — 20×20×11 Stepped Egyptian pyramid, sandstone, gold capstone.
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
const PYRAMID = `
|
|
60
|
+
Y0: 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H
|
|
61
|
+
| 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H
|
|
62
|
+
Y1: 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H
|
|
63
|
+
| 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H | 20H
|
|
64
|
+
Y2: 20A | 20A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A
|
|
65
|
+
| 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A
|
|
66
|
+
| 2A16H2A | 2A16H2A | 20A | 20A
|
|
67
|
+
Y3: 20A | 20A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A
|
|
68
|
+
| 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A | 2A16H2A
|
|
69
|
+
| 2A16H2A | 2A16H2A | 20A | 20A
|
|
70
|
+
Y4: 20A | 20A | 20A | 20A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A
|
|
71
|
+
| 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A
|
|
72
|
+
| 20A | 20A | 20A | 20A
|
|
73
|
+
Y5: 20A | 20A | 20A | 20A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A
|
|
74
|
+
| 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A | 4A12H4A
|
|
75
|
+
| 20A | 20A | 20A | 20A
|
|
76
|
+
Y6: 20A | 20A | 20A | 20A | 20A | 20A | 6A8H6A | 6A8H6A
|
|
77
|
+
| 6A8H6A | 6A8H6A | 6A8H6A | 6A8H6A | 6A8H6A | 6A8H6A | 20A | 20A
|
|
78
|
+
| 20A | 20A | 20A | 20A
|
|
79
|
+
Y7: 20A | 20A | 20A | 20A | 20A | 20A | 6A8H6A | 6A8H6A
|
|
80
|
+
| 6A8H6A | 6A8H6A | 6A8H6A | 6A8H6A | 6A8H6A | 6A8H6A | 20A | 20A
|
|
81
|
+
| 20A | 20A | 20A | 20A
|
|
82
|
+
Y8: 20A | 20A | 20A | 20A | 20A | 20A | 20A | 20A
|
|
83
|
+
| 8A4H8A | 8A4H8A | 8A4H8A | 8A4H8A | 20A | 20A | 20A | 20A
|
|
84
|
+
| 20A | 20A | 20A | 20A
|
|
85
|
+
Y9: 20A | 20A | 20A | 20A | 20A | 20A | 20A | 20A
|
|
86
|
+
| 8A4H8A | 8A4H8A | 8A4H8A | 8A4H8A | 20A | 20A | 20A | 20A
|
|
87
|
+
| 20A | 20A | 20A | 20A
|
|
88
|
+
Y10: 20A | 20A | 20A | 20A | 20A | 20A | 20A | 20A | 20A
|
|
89
|
+
| 9A2Y9A | 9A2Y9A | 20A | 20A | 20A | 20A | 20A | 20A | 20A | 20A | 20A
|
|
90
|
+
`;
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// ROCKET — 9×9×27 Saturn-V-style rocket: iron pad, fins, quartz body
|
|
93
|
+
// with windows + red bands, tapered nose, tiny red flame tip.
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
const ROCKET = `
|
|
96
|
+
Y0: 9I | 9I | 9I | 9I | 9I | 9I | 9I | 9I | 9I
|
|
97
|
+
Y1: 4AR4A | 4AR4A | 2A5I2A | 2A5I2A | 2R5I2R | 2A5I2A | 2A5I2A | 4AR4A | 4AR4A
|
|
98
|
+
Y2: 9A | 9A | 2A5I2A | 2A5I2A | 2A5I2A | 2A5I2A | 2A5I2A | 9A | 9A
|
|
99
|
+
Y3: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
100
|
+
Y4: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
101
|
+
Y5: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
102
|
+
Y6: 9A | 9A | 2A5R2A | 2A5R2A | 2A5R2A | 2A5R2A | 2A5R2A | 9A | 9A
|
|
103
|
+
Y7: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
104
|
+
Y8: 9A | 9A | 2AQQGQQ2A | 2A5Q2A | 2AGQQQG2A | 2A5Q2A | 2AQQGQQ2A | 9A | 9A
|
|
105
|
+
Y9: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
106
|
+
Y10: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
107
|
+
Y11: 9A | 9A | 2A5R2A | 2A5R2A | 2A5R2A | 2A5R2A | 2A5R2A | 9A | 9A
|
|
108
|
+
Y12: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
109
|
+
Y13: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
110
|
+
Y14: 9A | 9A | 2AQQGQQ2A | 2A5Q2A | 2AGQQQG2A | 2A5Q2A | 2AQQGQQ2A | 9A | 9A
|
|
111
|
+
Y15: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
112
|
+
Y16: 9A | 9A | 2A5R2A | 2A5R2A | 2A5R2A | 2A5R2A | 2A5R2A | 9A | 9A
|
|
113
|
+
Y17: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
114
|
+
Y18: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
115
|
+
Y19: 9A | 9A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 2A5Q2A | 9A | 9A
|
|
116
|
+
Y20: 9A | 9A | 9A | 3A3Q3A | 3A3Q3A | 3A3Q3A | 9A | 9A | 9A
|
|
117
|
+
Y21: 9A | 9A | 9A | 3A3Q3A | 3A3Q3A | 3A3Q3A | 9A | 9A | 9A
|
|
118
|
+
Y22: 9A | 9A | 9A | 3A3Q3A | 3A3Q3A | 3A3Q3A | 9A | 9A | 9A
|
|
119
|
+
Y23: 9A | 9A | 9A | 9A | 4AY4A | 9A | 9A | 9A | 9A
|
|
120
|
+
Y24: 9A | 9A | 9A | 9A | 4AY4A | 9A | 9A | 9A | 9A
|
|
121
|
+
Y25: 9A | 9A | 9A | 9A | 4AR4A | 9A | 9A | 9A | 9A
|
|
122
|
+
Y26: 9A | 9A | 9A | 9A | 4AR4A | 9A | 9A | 9A | 9A
|
|
123
|
+
`;
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// LIGHTHOUSE — 7×7×24 Stone base, alternating red/white bands, gallery
|
|
126
|
+
// railing, glass lantern room with sea-lantern light, stepped roof point.
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
const LIGHTHOUSE = `
|
|
129
|
+
Y0: 7S | 7S | 7S | 7S | 7S | 7S | 7S
|
|
130
|
+
Y1: 7S | 7S | 7S | 7S | 7S | 7S | 7S
|
|
131
|
+
Y2: 7A | A5SA | A5SA | A5SA | A5SA | A5SA | 7A
|
|
132
|
+
Y3: 7A | A5RA | A5RA | A5RA | A5RA | A5RA | 7A
|
|
133
|
+
Y4: 7A | A5RA | A5RA | A5RA | A5RA | A5RA | 7A
|
|
134
|
+
Y5: 7A | A5RA | A5RA | A5RA | A5RA | A5RA | 7A
|
|
135
|
+
Y6: 7A | A5QA | A5QA | A5QA | A5QA | A5QA | 7A
|
|
136
|
+
Y7: 7A | A5QA | A5QA | A5QA | A5QA | A5QA | 7A
|
|
137
|
+
Y8: 7A | A5QA | A5QA | A5QA | A5QA | A5QA | 7A
|
|
138
|
+
Y9: 7A | A5RA | A5RA | A5RA | A5RA | A5RA | 7A
|
|
139
|
+
Y10: 7A | A5RA | A5RA | A5RA | A5RA | A5RA | 7A
|
|
140
|
+
Y11: 7A | A5RA | A5RA | A5RA | A5RA | A5RA | 7A
|
|
141
|
+
Y12: 7A | A5QA | A5QA | A5QA | A5QA | A5QA | 7A
|
|
142
|
+
Y13: 7A | A5QA | A5QA | A5QA | A5QA | A5QA | 7A
|
|
143
|
+
Y14: 7A | A5QA | A5QA | A5QA | A5QA | A5QA | 7A
|
|
144
|
+
Y15: 7S | 7S | 7S | 7S | 7S | 7S | 7S
|
|
145
|
+
Y16: 7S | S5AS | S5AS | S5AS | S5AS | S5AS | 7S
|
|
146
|
+
Y17: 7A | A5GA | A5GA | A5GA | A5GA | A5GA | 7A
|
|
147
|
+
Y18: 7A | A5GA | A5GA | AG3UGA | A5GA | A5GA | 7A
|
|
148
|
+
Y19: 7A | A5GA | A5GA | A5GA | A5GA | A5GA | 7A
|
|
149
|
+
Y20: 7R | 7R | 7R | 7R | 7R | 7R | 7R
|
|
150
|
+
Y21: 7A | A5RA | A5RA | A5RA | A5RA | A5RA | 7A
|
|
151
|
+
Y22: 7A | 7A | 2A3R2A | 2A3R2A | 2A3R2A | 7A | 7A
|
|
152
|
+
Y23: 7A | 7A | 7A | 3AR3A | 7A | 7A | 7A
|
|
153
|
+
`;
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
// SKYSCRAPER — 12×12×25 Iron-framed glass tower, full floor plate every
|
|
156
|
+
// 4 levels, tapered profile (12→10→8→6→4→2), red spire on top.
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
const SKYSCRAPER = `
|
|
159
|
+
Y0: 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I
|
|
160
|
+
Y1: I10GI | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | I10GI
|
|
161
|
+
Y2: I10GI | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | I10GI
|
|
162
|
+
Y3: I10GI | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | G10AG | I10GI
|
|
163
|
+
Y4: 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I | 12I
|
|
164
|
+
Y5: 12A | AI8GIA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AI8GIA | 12A
|
|
165
|
+
Y6: 12A | AI8GIA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AI8GIA | 12A
|
|
166
|
+
Y7: 12A | AI8GIA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AG8AGA | AI8GIA | 12A
|
|
167
|
+
Y8: 12A | A10IA | A10IA | A10IA | A10IA | A10IA | A10IA | A10IA | A10IA | A10IA | A10IA | 12A
|
|
168
|
+
Y9: 12A | 12A | 2AI6GI2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AI6GI2A | 12A | 12A
|
|
169
|
+
Y10: 12A | 12A | 2AI6GI2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AI6GI2A | 12A | 12A
|
|
170
|
+
Y11: 12A | 12A | 2AI6GI2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AG6AG2A | 2AI6GI2A | 12A | 12A
|
|
171
|
+
Y12: 12A | 12A | 2A8I2A | 2A8I2A | 2A8I2A | 2A8I2A | 2A8I2A | 2A8I2A | 2A8I2A | 2A8I2A | 12A | 12A
|
|
172
|
+
Y13: 12A | 12A | 12A | 3AI4GI3A | 3AG4AG3A | 3AG4AG3A | 3AG4AG3A | 3AG4AG3A | 3AI4GI3A | 12A | 12A | 12A
|
|
173
|
+
Y14: 12A | 12A | 12A | 3AI4GI3A | 3AG4AG3A | 3AG4AG3A | 3AG4AG3A | 3AG4AG3A | 3AI4GI3A | 12A | 12A | 12A
|
|
174
|
+
Y15: 12A | 12A | 12A | 3AI4GI3A | 3AG4AG3A | 3AG4AG3A | 3AG4AG3A | 3AG4AG3A | 3AI4GI3A | 12A | 12A | 12A
|
|
175
|
+
Y16: 12A | 12A | 12A | 3A6I3A | 3A6I3A | 3A6I3A | 3A6I3A | 3A6I3A | 3A6I3A | 12A | 12A | 12A
|
|
176
|
+
Y17: 12A | 12A | 12A | 12A | 4AI2GI4A | 4AG2AG4A | 4AG2AG4A | 4AI2GI4A | 12A | 12A | 12A | 12A
|
|
177
|
+
Y18: 12A | 12A | 12A | 12A | 4AI2GI4A | 4AG2AG4A | 4AG2AG4A | 4AI2GI4A | 12A | 12A | 12A | 12A
|
|
178
|
+
Y19: 12A | 12A | 12A | 12A | 4AI2GI4A | 4AG2AG4A | 4AG2AG4A | 4AI2GI4A | 12A | 12A | 12A | 12A
|
|
179
|
+
Y20: 12A | 12A | 12A | 12A | 4A4I4A | 4A4I4A | 4A4I4A | 4A4I4A | 12A | 12A | 12A | 12A
|
|
180
|
+
Y21: 12A | 12A | 12A | 12A | 12A | 5A2I5A | 5A2I5A | 12A | 12A | 12A | 12A | 12A
|
|
181
|
+
Y22: 12A | 12A | 12A | 12A | 12A | 5A2R5A | 5A2R5A | 12A | 12A | 12A | 12A | 12A
|
|
182
|
+
Y23: 12A | 12A | 12A | 12A | 12A | 5AR6A | 12A | 12A | 12A | 12A | 12A | 12A
|
|
183
|
+
Y24: 12A | 12A | 12A | 12A | 12A | 5AR6A | 12A | 12A | 12A | 12A | 12A | 12A
|
|
184
|
+
`;
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
// PIRATE_SHIP — 15×7×14 Wooden hull with raised bow/stern, deck planks,
|
|
187
|
+
// central mast (oak log), white square sail, red pirate flag on top.
|
|
188
|
+
// ---------------------------------------------------------------------------
|
|
189
|
+
const PIRATE_SHIP = `
|
|
190
|
+
Y0: 15D | 15D | 15D | 15D | 15D | 15D | 15D
|
|
191
|
+
Y1: 15D | D13AD | D13AD | D13AD | D13AD | D13AD | 15D
|
|
192
|
+
Y2: 15D | D13AD | D13AD | D13AD | D13AD | D13AD | 15D
|
|
193
|
+
Y3: 15W | 15W | 15W | 15W | 15W | 15W | 15W
|
|
194
|
+
Y4: 15D | D13AD | D13AD | D13AD | D13AD | D13AD | 15D
|
|
195
|
+
Y5: 15D | D13AD | D13AD | D13AD | D13AD | D13AD | 15D
|
|
196
|
+
Y6: 15A | 15A | 15A | 7AF7A | 15A | 15A | 15A
|
|
197
|
+
Y7: 15A | 15A | 15A | 3A4QF4Q3A | 15A | 15A | 15A
|
|
198
|
+
Y8: 15A | 15A | 15A | 3A4QF4Q3A | 15A | 15A | 15A
|
|
199
|
+
Y9: 15A | 15A | 15A | 3A4QF4Q3A | 15A | 15A | 15A
|
|
200
|
+
Y10: 15A | 15A | 15A | 7AF7A | 15A | 15A | 15A
|
|
201
|
+
Y11: 15A | 15A | 6A3W6A | 6AWFW6A | 6A3W6A | 15A | 15A
|
|
202
|
+
Y12: 15A | 15A | 15A | 7AF7A | 15A | 15A | 15A
|
|
203
|
+
Y13: 15A | 15A | 15A | 7AR7A | 15A | 15A | 15A
|
|
204
|
+
`;
|
|
205
|
+
// ===========================================================================
|
|
206
|
+
// MAP STARTERS — minimal worlds for survival challenges. Sized so the 5×5
|
|
207
|
+
// (or 7×7) island sits centred on the fixed spawn at world (10, baseY+1, 10).
|
|
208
|
+
// ===========================================================================
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
// SKYBLOCK — classic floating dirt/grass island (5×5) with an oak tree at
|
|
211
|
+
// one corner and a starter chest on the opposite corner. Player spawns on
|
|
212
|
+
// top of the grass at the centre.
|
|
213
|
+
// ---------------------------------------------------------------------------
|
|
214
|
+
const SKYBLOCK = `
|
|
215
|
+
Y0: 13A | 13A | 13A | 13A | 13A | 13A | 13A | 13A
|
|
216
|
+
| 8A5g | 8A5g | 8A5g | 8A5g | 8A5g
|
|
217
|
+
Y1: 13A | 13A | 13A | 13A | 13A | 13A | 13A | 13A
|
|
218
|
+
| 8AF4A | 13A | 13A | 13A | 12Ac
|
|
219
|
+
Y2: 13A | 13A | 13A | 13A | 13A | 13A | 13A | 13A
|
|
220
|
+
| 8AF4A | 13A | 13A | 13A | 13A
|
|
221
|
+
Y3: 13A | 13A | 13A | 13A | 13A | 13A
|
|
222
|
+
| 6A5l2A | 6A5l2A | 6A2lF2l2A | 6A5l2A | 6A5l2A | 13A | 13A
|
|
223
|
+
Y4: 13A | 13A | 13A | 13A | 13A | 13A
|
|
224
|
+
| 6A5l2A | 6A5l2A | 6A2lF2l2A | 6A5l2A | 6A5l2A | 13A | 13A
|
|
225
|
+
Y5: 13A | 13A | 13A | 13A | 13A | 13A | 13A
|
|
226
|
+
| 7A3l3A | 7AlFl3A | 7A3l3A | 13A | 13A | 13A
|
|
227
|
+
Y6: 13A | 13A | 13A | 13A | 13A | 13A | 13A | 13A
|
|
228
|
+
| 8Al4A | 13A | 13A | 13A | 13A
|
|
229
|
+
`;
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
// VOID_PLATFORM — a single 5×5 obsidian pad floating in the void. Bring
|
|
232
|
+
// your own blocks. Good for creative / build servers.
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
const VOID_PLATFORM = `
|
|
235
|
+
Y0: 13A | 13A | 13A | 13A | 13A | 13A | 13A | 13A
|
|
236
|
+
| 8A5O | 8A5O | 8A5O | 8A5O | 8A5O
|
|
237
|
+
`;
|
|
238
|
+
// ---------------------------------------------------------------------------
|
|
239
|
+
// ONE_BLOCK — a single stone block at spawn. Mine it. See what happens.
|
|
240
|
+
// (The auto spawn-platform safety covers the same cell, so this is mostly
|
|
241
|
+
// a demonstration of the smallest possible template.)
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
243
|
+
const ONE_BLOCK = `
|
|
244
|
+
Y0: 11A | 11A | 11A | 11A | 11A | 11A | 11A | 11A | 11A | 11A | 10AS
|
|
245
|
+
`;
|
|
246
|
+
// ---------------------------------------------------------------------------
|
|
247
|
+
// Registry — keys are normalised to lowercase by `resolveTemplate`.
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
exports.TEMPLATE_EXAMPLES = {
|
|
250
|
+
// Cool builds
|
|
251
|
+
castle: CASTLE,
|
|
252
|
+
pyramid: PYRAMID,
|
|
253
|
+
rocket: ROCKET,
|
|
254
|
+
lighthouse: LIGHTHOUSE,
|
|
255
|
+
skyscraper: SKYSCRAPER,
|
|
256
|
+
pirate_ship: PIRATE_SHIP,
|
|
257
|
+
// Map starters
|
|
258
|
+
skyblock: SKYBLOCK,
|
|
259
|
+
void_platform: VOID_PLATFORM,
|
|
260
|
+
one_block: ONE_BLOCK,
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* If `templateStr` is exactly `[name]` (whitespace tolerated), return the
|
|
264
|
+
* matching built-in example; otherwise return `templateStr` unchanged.
|
|
265
|
+
*
|
|
266
|
+
* Throws when the example name is not registered.
|
|
267
|
+
*/
|
|
268
|
+
function resolveTemplate(templateStr) {
|
|
269
|
+
const m = templateStr.match(/^\s*\[([\w-]+)\]\s*$/);
|
|
270
|
+
if (!m)
|
|
271
|
+
return templateStr;
|
|
272
|
+
const name = m[1].toLowerCase();
|
|
273
|
+
const example = exports.TEMPLATE_EXAMPLES[name];
|
|
274
|
+
if (!example) {
|
|
275
|
+
throw new Error(`[chunkTemplate] Unknown example '${name}'. ` +
|
|
276
|
+
`Available: ${Object.keys(exports.TEMPLATE_EXAMPLES).join(', ')}`);
|
|
277
|
+
}
|
|
278
|
+
return example;
|
|
279
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const minigame: (server: Server) => void;
|