minerender 2.1.0-alpha.63 → 2.1.0-alpha.64
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/browser/index.d.mts +5 -1
- package/dist/browser/index.d.ts +5 -1
- package/dist/browser/index.js +9 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +9 -4
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +9 -4
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +5 -1
- package/dist/node/index.d.ts +5 -1
- package/dist/node/index.js +9 -4
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +9 -4
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -11246,7 +11246,11 @@ var legacyBlocks_default = {
|
|
|
11246
11246
|
|
|
11247
11247
|
// src/model/multiblock/SchematicParser.ts
|
|
11248
11248
|
var SchematicParser = class {
|
|
11249
|
-
|
|
11249
|
+
/**
|
|
11250
|
+
* Parses a legacy schematic using custom mappings before the bundled defaults.
|
|
11251
|
+
* Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
|
|
11252
|
+
*/
|
|
11253
|
+
static async parse(nbt, customMappings = {}) {
|
|
11250
11254
|
const tags = nbt.value;
|
|
11251
11255
|
if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
|
|
11252
11256
|
throw new MineRenderError("Schematic Materials must be Alpha");
|
|
@@ -11288,15 +11292,16 @@ var SchematicParser = class {
|
|
|
11288
11292
|
const high = packed >> (index & 1) * 4 & 15;
|
|
11289
11293
|
const id = high << 8 | ids.value[index] & 255;
|
|
11290
11294
|
const metadata = data.value[index] & 255;
|
|
11291
|
-
const
|
|
11295
|
+
const key = `${id}:${metadata}`;
|
|
11296
|
+
const mapped = customMappings[key] ?? mapping[key];
|
|
11292
11297
|
if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
|
|
11293
11298
|
const [type, state] = mapped.split("[");
|
|
11294
11299
|
if (type === "minecraft:air") continue;
|
|
11295
11300
|
const properties = {};
|
|
11296
11301
|
if (state) {
|
|
11297
11302
|
for (const property of state.slice(0, -1).split(",")) {
|
|
11298
|
-
const [
|
|
11299
|
-
properties[
|
|
11303
|
+
const [key2, value] = property.split("=");
|
|
11304
|
+
properties[key2] = value;
|
|
11300
11305
|
}
|
|
11301
11306
|
}
|
|
11302
11307
|
blocks.push({
|