@nodecraft/rendermite 1.4.1 → 1.6.0
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/README.md +3 -0
- package/dist/blocks/cli.js +1 -1
- package/dist/blocks/entities.d.ts +30 -0
- package/dist/blocks/entities.js +2 -0
- package/dist/blocks/entity-geo.d.ts +18 -0
- package/dist/blocks/entity-geo.js +2 -0
- package/dist/blocks/entity-models.d.ts +2 -0
- package/dist/blocks/entity-models.js +2 -0
- package/dist/blocks/export.d.ts +1 -1
- package/dist/blocks/export.js +1 -1
- package/dist/blocks/item-sprites.d.ts +34 -0
- package/dist/blocks/item-sprites.js +2 -0
- package/dist/blocks/obj-mesh.js +1 -1
- package/dist/blocks/pack-format.d.ts +2 -2
- package/dist/blocks/sprite-sheet.d.ts +59 -0
- package/dist/blocks/sprite-sheet.js +2 -0
- package/dist/classfile-BwaQjnUM.d.ts +51 -0
- package/dist/classfile-CAhS5qNf.js +255 -0
- package/dist/{cli-DqJtT-Ms.js → cli-BSKnXBPr.js} +31 -4
- package/dist/cli.js +5 -5
- package/dist/{discovery-CsZu08re.js → discovery-CD0QqxSF.js} +1 -1
- package/dist/{discovery-C5ZR4aoG.d.ts → discovery-Cmir3QfC.d.ts} +8 -1
- package/dist/entities/classfile.d.ts +2 -0
- package/dist/entities/classfile.js +2 -0
- package/dist/entities/geo-model.d.ts +13 -0
- package/dist/entities/geo-model.js +2 -0
- package/dist/entities/inherit.d.ts +29 -0
- package/dist/entities/inherit.js +2 -0
- package/dist/entities/jar-classes.d.ts +26 -0
- package/dist/entities/jar-classes.js +2 -0
- package/dist/entities/link.d.ts +71 -0
- package/dist/entities/link.js +2 -0
- package/dist/entities/mappings.d.ts +2 -0
- package/dist/entities/mappings.js +2 -0
- package/dist/entities/merge.d.ts +18 -0
- package/dist/entities/merge.js +2 -0
- package/dist/entities/model-bytecode.d.ts +31 -0
- package/dist/entities/model-bytecode.js +2 -0
- package/dist/entities/model-code.d.ts +2 -0
- package/dist/entities/model-code.js +2 -0
- package/dist/entities/model.d.ts +2 -0
- package/dist/entities/model.js +1 -0
- package/dist/entities-DvmA9fEV.js +175 -0
- package/dist/{entity-fallback-BTkM8j0V.js → entity-fallback-Bth0fa7m.js} +1 -1
- package/dist/entity-geo-B2CkuMWx.js +100 -0
- package/dist/entity-models-B6-0r2gR.js +123 -0
- package/dist/entity-models-c2HpfdWV.d.ts +49 -0
- package/dist/{export-Bllg8Fw7.d.ts → export-D8fLC1wS.d.ts} +30 -1
- package/dist/{export-kMoMes_a.js → export-DT_drDoI.js} +182 -160
- package/dist/geo-CmjrXu0G.d.ts +59 -0
- package/dist/{geo-BguldlU-.js → geo-Desq-gRC.js} +5 -4
- package/dist/geo-model-Bo1gpEwX.js +163 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -10
- package/dist/inherit-KkDsM2N_.js +77 -0
- package/dist/item-sprites-G-yikdfV.js +126 -0
- package/dist/items/discovery.d.ts +2 -2
- package/dist/items/discovery.js +2 -2
- package/dist/jar-classes-Bj15hjdr.js +75 -0
- package/dist/link-Bm5oQYh6.js +331 -0
- package/dist/mappings-BEPVaiwE.js +139 -0
- package/dist/mappings-DxX4KoZl.d.ts +75 -0
- package/dist/merge-3HkeQ_6A.js +46 -0
- package/dist/model-PnQ4gV0-.d.ts +49 -0
- package/dist/model-bytecode-C1nw2G8O.js +732 -0
- package/dist/model-code-B7jSFQqd.d.ts +16 -0
- package/dist/model-code-BKMEMXxF.js +49 -0
- package/dist/mods/prepare.js +1 -1
- package/dist/mods/tints.js +1 -1
- package/dist/{obj-bvs3gwex.js → obj-CJHEHpki.js} +4 -4
- package/dist/{obj-mesh-rnYbSbpv.js → obj-mesh-JwPkZEWL.js} +1 -1
- package/dist/pack-format-QcVFxG_b.d.ts +280 -0
- package/dist/pack.d.ts +1 -1
- package/dist/{pipeline-B8e6x8Hh.js → pipeline-BUIMzMzg.js} +6 -6
- package/dist/{prepare-C9gjqQTt.js → prepare-Myd_ec4v.js} +2 -2
- package/dist/render/entity-fallback.js +1 -1
- package/dist/render/face.js +1 -1
- package/dist/render/geo.d.ts +2 -54
- package/dist/render/geo.js +2 -2
- package/dist/render/obj.js +1 -1
- package/dist/render/pipeline.js +1 -1
- package/dist/render/renderer.js +1 -1
- package/dist/resources/descriptor.js +1 -1
- package/dist/{run-B_JAUbXe.js → run-BQJkqc5f.js} +3 -3
- package/dist/run.js +1 -1
- package/dist/sprite-sheet-LQAEtGkp.js +185 -0
- package/dist/versions/prepare.js +1 -1
- package/dist/workers/render-worker.js +2 -2
- package/package.json +1 -1
- package/dist/pack-format-BVC_B-ZW.d.ts +0 -140
- package/dist/{descriptor-D7VKgeGT.js → descriptor-JyXhfd-c.js} +1 -1
- package/dist/{face-CKHboPfh.js → face-B2JjWT46.js} +1 -1
- package/dist/{prepare-8LswFoS-.js → prepare-D49Gu4Lv.js} +1 -1
- package/dist/{tints-C1tT6pKk.js → tints-BspVCz2G.js} +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as ClassFile } from "./classfile-BwaQjnUM.js";
|
|
2
|
+
//#region src/entities/model-code.d.ts
|
|
3
|
+
interface ModelCode {
|
|
4
|
+
/** The parsed class, when it is model code a call may be followed into. */
|
|
5
|
+
resolve: (internalName: string) => ClassFile | null;
|
|
6
|
+
}
|
|
7
|
+
declare function isModelCode(name: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Reads every model class in a jar, ready to interpret.
|
|
10
|
+
*
|
|
11
|
+
* Read up front because interpretation is synchronous and a call's target is only known once it is
|
|
12
|
+
* reached. Parsing stays lazy: a jar has a few hundred of these and a model only ever calls a handful.
|
|
13
|
+
*/
|
|
14
|
+
declare function loadModelCode(names: Iterable<string>, read: (internalName: string) => Promise<Uint8Array | null>, originalOf?: (internalName: string) => string): Promise<ModelCode>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isModelCode as n, loadModelCode as r, ModelCode as t };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { t as parseClassFile } from "./classfile-CAhS5qNf.js";
|
|
2
|
+
//#region src/entities/model-code.ts
|
|
3
|
+
/**
|
|
4
|
+
* Which classes in a jar count as model code, and their parsed form.
|
|
5
|
+
*
|
|
6
|
+
* The interpreter follows calls into model code and models the builder API abstractly instead, so the
|
|
7
|
+
* line between the two has to be drawn somewhere. It is drawn by name: everything with `model` in its
|
|
8
|
+
* path except the `client.model.geom` package, which is `CubeListBuilder`, `PartDefinition`, `PartPose`
|
|
9
|
+
* and friends. Following `CubeListBuilder.addBox` into its real implementation would interpret a list
|
|
10
|
+
* append and lose the box.
|
|
11
|
+
*
|
|
12
|
+
* The name tested is the *original* one, so an obfuscated jar needs its mappings. Which is fine: they
|
|
13
|
+
* are already loaded to find the model classes at all.
|
|
14
|
+
*/
|
|
15
|
+
function isModelCode(name) {
|
|
16
|
+
const lower = name.toLowerCase();
|
|
17
|
+
return lower.includes("model") && !lower.includes("geom");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Reads every model class in a jar, ready to interpret.
|
|
21
|
+
*
|
|
22
|
+
* Read up front because interpretation is synchronous and a call's target is only known once it is
|
|
23
|
+
* reached. Parsing stays lazy: a jar has a few hundred of these and a model only ever calls a handful.
|
|
24
|
+
*/
|
|
25
|
+
async function loadModelCode(names, read, originalOf) {
|
|
26
|
+
const code = /* @__PURE__ */ new Map();
|
|
27
|
+
for (const name of names) {
|
|
28
|
+
if (!isModelCode(originalOf?.(name) ?? name)) continue;
|
|
29
|
+
const bytes = await read(name);
|
|
30
|
+
if (bytes) code.set(name.replaceAll(".", "/"), bytes);
|
|
31
|
+
}
|
|
32
|
+
const parsed = /* @__PURE__ */ new Map();
|
|
33
|
+
return { resolve: (name) => {
|
|
34
|
+
const internalName = name.replaceAll(".", "/");
|
|
35
|
+
if (!parsed.has(internalName)) {
|
|
36
|
+
const bytes = code.get(internalName);
|
|
37
|
+
let classFile;
|
|
38
|
+
try {
|
|
39
|
+
classFile = bytes ? parseClassFile(bytes) : null;
|
|
40
|
+
} catch {
|
|
41
|
+
classFile = null;
|
|
42
|
+
}
|
|
43
|
+
parsed.set(internalName, classFile);
|
|
44
|
+
}
|
|
45
|
+
return parsed.get(internalName) ?? null;
|
|
46
|
+
} };
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { loadModelCode as n, isModelCode as t };
|
package/dist/mods/prepare.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-
|
|
1
|
+
import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-Myd_ec4v.js";
|
|
2
2
|
export { LOADER_NAMESPACES, prepareModResources };
|
package/dist/mods/tints.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as harvestTintOverrides, t as curatedTintOverrides } from "../tints-
|
|
1
|
+
import { n as harvestTintOverrides, t as curatedTintOverrides } from "../tints-BspVCz2G.js";
|
|
2
2
|
export { curatedTintOverrides, harvestTintOverrides };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { l as toFloatTexture, n as cloneFloatTexture, r as darkenTexture, s as tintTexture, t as blendPixel } from "./blend-KXMclcHk.js";
|
|
3
|
+
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
4
|
+
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-DcVJzkxz.js";
|
|
3
5
|
import { c as normalize, g as transformVector, m as sub, n as displayMatrix, o as identity, r as dot, s as multiply, t as cross } from "./vector-CCxLae_T.js";
|
|
6
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-B2JjWT46.js";
|
|
4
7
|
import { c as lightsForProfile } from "./lighting--5myudVu.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
7
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-CKHboPfh.js";
|
|
8
|
+
import { i as resolveTexture } from "./loader-C-NuJaEi.js";
|
|
8
9
|
import { t as paintBucketFluid } from "./fluid-bucket-B-I4ZYHl.js";
|
|
9
10
|
import { r as buildElementFaces } from "./geometry-Bi-Bf5rb.js";
|
|
10
|
-
import { i as resolveTexture } from "./loader-C-NuJaEi.js";
|
|
11
11
|
//#region src/render/renderer.ts
|
|
12
12
|
/**
|
|
13
13
|
* Item rendering entry: flat generated items (2D layer compositing) and 3D
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
-
import { n as parseMtl, r as parseObj, t as materialTexture } from "./obj-
|
|
2
|
+
import { n as parseMtl, r as parseObj, t as materialTexture } from "./obj-CJHEHpki.js";
|
|
3
3
|
//#region src/blocks/obj-mesh.ts
|
|
4
4
|
/**
|
|
5
5
|
* OBJ geometry as pack data.
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { n as BiomeClimatePack } from "./biomes-CJDJQqJb.js";
|
|
2
|
+
import { a as FaceDirectionName, l as Vec3, o as ModelElementJson, u as Vec4 } from "./types-qlp3I8_-.js";
|
|
3
|
+
import { a as BlockStateMultipartCase, o as BlockStateVariantCase } from "./blockstate-eval-BzznRcVY.js";
|
|
4
|
+
import { t as MeshGroup } from "./obj-mesh-ydhVfLKs.js";
|
|
5
|
+
import { n as BlockTintPack } from "./tints-DoBv5S9v.js";
|
|
6
|
+
//#region src/blocks/pack-format.d.ts
|
|
7
|
+
/** How a sprite's alpha classifies it, inferred because assets rarely say. */
|
|
8
|
+
type BlockPackRenderLayer = 'solid' | 'cutout' | 'translucent';
|
|
9
|
+
interface BlockPackFace {
|
|
10
|
+
sprite: string;
|
|
11
|
+
/** [u1, v1, u2, v2] in 0–16 sprite space, derived when the model omits it. */
|
|
12
|
+
uv: Vec4;
|
|
13
|
+
rotation?: number;
|
|
14
|
+
tintindex?: number;
|
|
15
|
+
cullface?: FaceDirectionName;
|
|
16
|
+
}
|
|
17
|
+
interface BlockPackElement {
|
|
18
|
+
from: Vec3;
|
|
19
|
+
to: Vec3;
|
|
20
|
+
rotation?: ModelElementJson['rotation'];
|
|
21
|
+
shade?: false;
|
|
22
|
+
faces: Partial<Record<FaceDirectionName, BlockPackFace>>;
|
|
23
|
+
}
|
|
24
|
+
interface BlockPackModel {
|
|
25
|
+
ao: boolean;
|
|
26
|
+
elements: BlockPackElement[];
|
|
27
|
+
/**
|
|
28
|
+
* The model's `particle` texture. What the game throws when the block breaks
|
|
29
|
+
* or is walked on, and the only colour a consumer has to work with for a
|
|
30
|
+
* block that draws nothing — a placeholder cube for a chest comes out oak
|
|
31
|
+
* rather than magenta.
|
|
32
|
+
*/
|
|
33
|
+
particle?: string;
|
|
34
|
+
/** Triangle geometry from an OBJ loader, when the model uses one. */
|
|
35
|
+
mesh?: MeshGroup[];
|
|
36
|
+
/**
|
|
37
|
+
* The layer the model states it draws on. Authoritative where present, and
|
|
38
|
+
* it beats the per-sprite alpha inference — the same sprite can be solid in
|
|
39
|
+
* one model and translucent in another.
|
|
40
|
+
*/
|
|
41
|
+
renderType?: BlockPackRenderLayer;
|
|
42
|
+
/** Block offsets a split-multiblock mesh spans. */
|
|
43
|
+
multiblock?: Array<[number, number, number]>;
|
|
44
|
+
/**
|
|
45
|
+
* Present when the block is a fluid, whose real surface height and flow
|
|
46
|
+
* direction come from its neighbours and so cannot be baked. The cube here is
|
|
47
|
+
* a stand-in; these are the sheets to mesh the real thing with.
|
|
48
|
+
*/
|
|
49
|
+
fluid?: {
|
|
50
|
+
still: string;
|
|
51
|
+
flow: string;
|
|
52
|
+
overlay?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface BlockPackSpriteFrame {
|
|
56
|
+
page: number;
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
/** Duration in game ticks. */
|
|
60
|
+
time: number;
|
|
61
|
+
}
|
|
62
|
+
interface BlockPackSprite {
|
|
63
|
+
page: number;
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
w: number;
|
|
67
|
+
h: number;
|
|
68
|
+
layer: BlockPackRenderLayer;
|
|
69
|
+
/** The displayed sequence, which can revisit a frame; absent when static. */
|
|
70
|
+
frames?: BlockPackSpriteFrame[];
|
|
71
|
+
interpolate?: true;
|
|
72
|
+
}
|
|
73
|
+
interface BlockPackAtlasPage {
|
|
74
|
+
file: string;
|
|
75
|
+
width: number;
|
|
76
|
+
height: number;
|
|
77
|
+
}
|
|
78
|
+
/** `atlas.json`. */
|
|
79
|
+
interface BlockPackAtlasFile {
|
|
80
|
+
/** Edge-extended border per sprite, in pixels. */
|
|
81
|
+
padding: number;
|
|
82
|
+
pages: BlockPackAtlasPage[];
|
|
83
|
+
sprites: Record<string, BlockPackSprite>;
|
|
84
|
+
}
|
|
85
|
+
/** `models.json`, by fully-qualified model id. */
|
|
86
|
+
type BlockPackModelsFile = Record<string, BlockPackModel>;
|
|
87
|
+
/** `blockstates.json`, by block id, with keys and predicates already parsed. */
|
|
88
|
+
type BlockPackBlockStatesFile = Record<string, BlockPackBlockState>;
|
|
89
|
+
/**
|
|
90
|
+
* A variant as the pack writes it. Every rotation is optional because the emit
|
|
91
|
+
* drops each one at its default, which is most of them.
|
|
92
|
+
*/
|
|
93
|
+
interface BlockPackVariant {
|
|
94
|
+
model: string;
|
|
95
|
+
x?: number;
|
|
96
|
+
y?: number;
|
|
97
|
+
z?: number;
|
|
98
|
+
uvlock?: true;
|
|
99
|
+
weight?: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* One block's cases as the pack writes them: what `evaluateBlockState` takes,
|
|
103
|
+
* flattened to the key the file uses. Pass it as
|
|
104
|
+
* `{ kind: 'variants', cases: state.variants }` and the models come back as
|
|
105
|
+
* `BlockPackVariant`, no cast in either direction.
|
|
106
|
+
*/
|
|
107
|
+
type BlockPackBlockState = {
|
|
108
|
+
variants: Array<BlockStateVariantCase<BlockPackVariant>>;
|
|
109
|
+
multipart?: undefined;
|
|
110
|
+
} | {
|
|
111
|
+
multipart: Array<BlockStateMultipartCase<BlockPackVariant>>;
|
|
112
|
+
variants?: undefined;
|
|
113
|
+
};
|
|
114
|
+
/** `tints.json`. */
|
|
115
|
+
type BlockPackTintsFile = BlockTintPack;
|
|
116
|
+
/**
|
|
117
|
+
* `biomes.json`, present only when the pack has biomes to describe: vanilla's
|
|
118
|
+
* whole table, or the ones a mod's datapack declares. Absent is not empty — a
|
|
119
|
+
* consumer with no file falls back to tinting at `tints.json`'s flat climate.
|
|
120
|
+
*/
|
|
121
|
+
type BlockPackBiomesFile = BiomeClimatePack;
|
|
122
|
+
/** One flat sprite of an item's layer stack, in the order the client draws them. */
|
|
123
|
+
interface ItemPackLayer {
|
|
124
|
+
sprite: string;
|
|
125
|
+
/**
|
|
126
|
+
* Present when the item declares a tint at this layer, which is the client's own
|
|
127
|
+
* rule: `ItemModelGenerator` passes each layer its own index as the tint index.
|
|
128
|
+
*/
|
|
129
|
+
tintindex?: number;
|
|
130
|
+
/**
|
|
131
|
+
* The colour that tint resolves to in an item's default state, `#rrggbb`.
|
|
132
|
+
*
|
|
133
|
+
* Absent where it cannot be known from assets — a dyed leather boot or a potion
|
|
134
|
+
* takes its colour from the stack's components, which no pack can carry. A
|
|
135
|
+
* consumer drawing an absent tint untinted gets the mod's own artwork, which is
|
|
136
|
+
* the same thing the icon renderer settles for.
|
|
137
|
+
*/
|
|
138
|
+
tint?: string;
|
|
139
|
+
}
|
|
140
|
+
/** One flat item: everything there is to say about how the game draws it. */
|
|
141
|
+
interface ItemPackEntry {
|
|
142
|
+
layers: ItemPackLayer[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* `items.json`. Self-contained rather than sharing `atlas.json`'s pages, so a
|
|
146
|
+
* consumer that only draws blocks never fetches the item sheet at all — a world
|
|
147
|
+
* viewer needs it only once it finds a dropped stack of something that is not a
|
|
148
|
+
* block.
|
|
149
|
+
*
|
|
150
|
+
* Holds *only* items whose model is a flat sprite stack. An item absent from
|
|
151
|
+
* `items` either draws from `blockstates.json` under the same id, or is in
|
|
152
|
+
* `failures.json` saying why nothing can draw it.
|
|
153
|
+
*/
|
|
154
|
+
interface BlockPackItemsFile {
|
|
155
|
+
/** Edge-extended border per sprite, in pixels. */
|
|
156
|
+
padding: number;
|
|
157
|
+
pages: BlockPackAtlasPage[];
|
|
158
|
+
sprites: Record<string, BlockPackSprite>;
|
|
159
|
+
items: Record<string, ItemPackEntry>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* One entity type: what to call it, and what colour it is.
|
|
163
|
+
*
|
|
164
|
+
* No geometry, because no jar has any — entity models are Java code at every version. What a consumer
|
|
165
|
+
* can do with this is name the stand-in box it draws and tint it like the animal, which is the
|
|
166
|
+
* difference between a field of arbitrary colours and a readable one.
|
|
167
|
+
*/
|
|
168
|
+
interface EntityPackEntry {
|
|
169
|
+
/** English display name, from the jar's own lang file. */
|
|
170
|
+
name: string;
|
|
171
|
+
/**
|
|
172
|
+
* Mean colour of the opaque pixels of the entity's sheet, `#rrggbb`.
|
|
173
|
+
*
|
|
174
|
+
* Absent for everything that is not a mob — an item entity, a falling block, a marker, a display,
|
|
175
|
+
* a thrown projectile — because those draw from an item or a block and have no sheet of their own.
|
|
176
|
+
* None is invented for them.
|
|
177
|
+
*/
|
|
178
|
+
color?: string;
|
|
179
|
+
/**
|
|
180
|
+
* The sheet the colour came from, and what the model's `uv` values address. A sprite id in
|
|
181
|
+
* `entity-models.json`'s atlas once that file is present.
|
|
182
|
+
*/
|
|
183
|
+
texture?: string;
|
|
184
|
+
/** Key into `entity-models.json`'s `models`, when geometry was recovered for this entity. */
|
|
185
|
+
model?: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* `entities.json`, by entity id. The registry read off the lang file, which is the closest thing a jar
|
|
189
|
+
* carries to it. Absent from a pack whose namespaces register no entities.
|
|
190
|
+
*/
|
|
191
|
+
type BlockPackEntitiesFile = Record<string, EntityPackEntry>;
|
|
192
|
+
/** One box of a part, in the model's own space, exactly as the game's own builder stated it. */
|
|
193
|
+
/** The six faces a box can carry its own texture rect on. */
|
|
194
|
+
type EntityPackCubeFace = 'north' | 'south' | 'east' | 'west' | 'up' | 'down';
|
|
195
|
+
interface EntityPackCube {
|
|
196
|
+
/** Minimum corner. */
|
|
197
|
+
origin: Vec3;
|
|
198
|
+
size: Vec3;
|
|
199
|
+
/** Texture offset in pixels on the entity's own sheet, as `texOffs` set it. */
|
|
200
|
+
uv: [number, number];
|
|
201
|
+
/** Grows the box on every side; `CubeDeformation`, or a builder's `delta`. */
|
|
202
|
+
inflate?: number;
|
|
203
|
+
mirror?: true;
|
|
204
|
+
/**
|
|
205
|
+
* Per-face texture rects, which replace the box unwrap `uv` implies wherever they are present.
|
|
206
|
+
*
|
|
207
|
+
* Java has no such thing, since `addBox` always unwraps the same way, but bedrock geometry does and
|
|
208
|
+
* leans on it: 56% of the cubes across four GeckoLib mods state their faces individually. A consumer
|
|
209
|
+
* that ignores this draws over half of every such mob from the wrong part of its sheet.
|
|
210
|
+
*/
|
|
211
|
+
faces?: Partial<Record<EntityPackCubeFace, {
|
|
212
|
+
uv: [number, number];
|
|
213
|
+
size: [number, number];
|
|
214
|
+
}>>;
|
|
215
|
+
}
|
|
216
|
+
/** One bone: where it pivots, what it is made of, and what hangs off it. */
|
|
217
|
+
interface EntityPackPart {
|
|
218
|
+
name: string;
|
|
219
|
+
/** Pivot relative to the parent bone. */
|
|
220
|
+
pivot: Vec3;
|
|
221
|
+
/** Radians about x, y, z, as `PartPose.offsetAndRotation` states them. */
|
|
222
|
+
rotation: Vec3;
|
|
223
|
+
cubes: EntityPackCube[];
|
|
224
|
+
children: EntityPackPart[];
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* One entity model: a bone hierarchy of boxes, recovered from the client's own code.
|
|
228
|
+
*
|
|
229
|
+
* `textureSize` is the sheet the `uv` values are in, which is *not* the atlas page — a consumer maps
|
|
230
|
+
* `uv` through it into the sprite's rect, exactly as it does for a block face.
|
|
231
|
+
*
|
|
232
|
+
* **Prefer the sprite's own `w`/`h` where the entity has one**, and keep this as the fallback. One
|
|
233
|
+
* model can be drawn on two differently sized sheets: from 1.21.4 a boat and a chest boat are both a
|
|
234
|
+
* `BoatModel`, on a 128x64 and a 128x128 sheet respectively, so no single value here is right for both.
|
|
235
|
+
*/
|
|
236
|
+
interface EntityPackModel {
|
|
237
|
+
textureSize: [number, number];
|
|
238
|
+
parts: EntityPackPart[];
|
|
239
|
+
/** Anything the extraction had to skip or assume, so a consumer can distrust it knowingly. */
|
|
240
|
+
notes?: string[];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* `entity-models.json`. Self-contained like `items.json`, with its own atlas of entity sheets, so a
|
|
244
|
+
* consumer that never draws a mob does not fetch any of it.
|
|
245
|
+
*
|
|
246
|
+
* `models` is keyed by the class the geometry came from, and `entities.json`'s `model` points at it —
|
|
247
|
+
* several entities share one model (every zombie is a `HumanoidModel`), and keying by class is what
|
|
248
|
+
* makes that one entry rather than twenty copies.
|
|
249
|
+
*/
|
|
250
|
+
interface BlockPackEntityModelsFile {
|
|
251
|
+
padding: number;
|
|
252
|
+
pages: BlockPackAtlasPage[];
|
|
253
|
+
sprites: Record<string, BlockPackSprite>;
|
|
254
|
+
models: Record<string, EntityPackModel>;
|
|
255
|
+
}
|
|
256
|
+
/** `meta.json`, written last because it hashes every other file. */
|
|
257
|
+
interface BlockPackMetaFile {
|
|
258
|
+
generator: string;
|
|
259
|
+
version: string;
|
|
260
|
+
namespaces: string[];
|
|
261
|
+
counts: {
|
|
262
|
+
blocks: number;
|
|
263
|
+
models: number;
|
|
264
|
+
sprites: number;
|
|
265
|
+
pages: number;
|
|
266
|
+
/** Biomes in `biomes.json`; `0` means the pack has none and the file is absent. */
|
|
267
|
+
biomes: number;
|
|
268
|
+
/** Flat items in `items.json`; `0` means the pack has none and the file is absent. */
|
|
269
|
+
items: number;
|
|
270
|
+
/** Entity types in `entities.json`; `0` means the pack has none and the file is absent. */
|
|
271
|
+
entities: number;
|
|
272
|
+
/** Distinct entity models in `entity-models.json`; `0` means the file is absent. */
|
|
273
|
+
entityModels: number;
|
|
274
|
+
failures: number;
|
|
275
|
+
};
|
|
276
|
+
/** sha256 per file, enough to verify a cached copy without refetching it. */
|
|
277
|
+
hashes: Record<string, string>;
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
export { EntityPackPart as C, EntityPackModel as S, ItemPackLayer as T, BlockPackTintsFile as _, BlockPackBlockStatesFile as a, EntityPackCubeFace as b, BlockPackEntityModelsFile as c, BlockPackMetaFile as d, BlockPackModel as f, BlockPackSpriteFrame as g, BlockPackSprite as h, BlockPackBlockState as i, BlockPackFace as l, BlockPackRenderLayer as m, BlockPackAtlasPage as n, BlockPackElement as o, BlockPackModelsFile as p, BlockPackBiomesFile as r, BlockPackEntitiesFile as s, BlockPackAtlasFile as t, BlockPackItemsFile as u, BlockPackVariant as v, ItemPackEntry as w, EntityPackEntry as x, EntityPackCube as y };
|
package/dist/pack.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { n as BiomeClimatePack, t as BiomeClimate } from "./biomes-CJDJQqJb.js";
|
|
|
2
2
|
import { a as BlockStateMultipartCase, d as matchesCondition, n as BlockProperties, o as BlockStateVariantCase, p as weightedVariantIndex, r as BlockStateDefinition, s as MultipartCondition, t as BlockModelVariant, u as evaluateBlockState } from "./blockstate-eval-BzznRcVY.js";
|
|
3
3
|
import { n as ObjMesh, t as MeshGroup } from "./obj-mesh-ydhVfLKs.js";
|
|
4
4
|
import { n as BlockTintPack, t as BlockTint } from "./tints-DoBv5S9v.js";
|
|
5
|
-
import { a as BlockPackBlockStatesFile,
|
|
5
|
+
import { _ as BlockPackTintsFile, a as BlockPackBlockStatesFile, d as BlockPackMetaFile, f as BlockPackModel, g as BlockPackSpriteFrame, h as BlockPackSprite, i as BlockPackBlockState, l as BlockPackFace, m as BlockPackRenderLayer, n as BlockPackAtlasPage, o as BlockPackElement, p as BlockPackModelsFile, r as BlockPackBiomesFile, t as BlockPackAtlasFile, v as BlockPackVariant } from "./pack-format-QcVFxG_b.js";
|
|
6
6
|
export { type BiomeClimate, type BiomeClimatePack, type BlockModelVariant, type BlockPackAtlasFile, type BlockPackAtlasPage, type BlockPackBiomesFile, type BlockPackBlockState, type BlockPackBlockStatesFile, type BlockPackElement, type BlockPackFace, type BlockPackMetaFile, type BlockPackModel, type BlockPackModelsFile, type BlockPackRenderLayer, type BlockPackSprite, type BlockPackSpriteFrame, type BlockPackTintsFile, type BlockPackVariant, type BlockProperties, type BlockStateDefinition, type BlockStateMultipartCase, type BlockStateVariantCase, type BlockTint, type BlockTintPack, type MeshGroup, type MultipartCondition, type ObjMesh, evaluateBlockState, matchesCondition, weightedVariantIndex };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { l as toFloatTexture, t as blendPixel } from "./blend-KXMclcHk.js";
|
|
3
|
+
import { a as renderGeo, t as findGeoForItem } from "./geo-Desq-gRC.js";
|
|
4
|
+
import { a as defaultProperties } from "./definition-ColsvWrH.js";
|
|
5
|
+
import { i as resolveItem } from "./discovery-CD0QqxSF.js";
|
|
3
6
|
import { t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
4
|
-
import {
|
|
7
|
+
import { a as resolveTints } from "./tints-B3WQcPtx.js";
|
|
8
|
+
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-CJHEHpki.js";
|
|
5
9
|
import { t as loadAtlasResolver } from "./registry-DlduyjtM.js";
|
|
6
10
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-BNibYkmI.js";
|
|
7
11
|
import { n as TextureLoader } from "./loader-C18GpurU.js";
|
|
8
|
-
import { a as defaultProperties } from "./definition-ColsvWrH.js";
|
|
9
|
-
import { r as resolveItem } from "./discovery-CsZu08re.js";
|
|
10
12
|
import { t as encodeAnimatedIcon } from "./encode-LR9wxigC.js";
|
|
11
13
|
import { a as builtinDynamicResources } from "./generators-BCZVlWig.js";
|
|
12
|
-
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-
|
|
13
|
-
import { i as renderGeo, t as findGeoForItem } from "./geo-BguldlU-.js";
|
|
14
|
+
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-Bth0fa7m.js";
|
|
14
15
|
import { t as legacyTintsForChain } from "./legacy-tints-l-541wgI.js";
|
|
15
|
-
import { a as resolveTints } from "./tints-B3WQcPtx.js";
|
|
16
16
|
import { n as defaultBlockStateModel, t as blockStateTransform } from "./blockstate-DVb8Mhxc.js";
|
|
17
17
|
import path from "node:path";
|
|
18
18
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as LayeredResourceManager } from "./manager-BNibYkmI.js";
|
|
2
|
+
import { n as UnsafeJarError, t as JarResourceManager } from "./jar-W2cV2ZVO.js";
|
|
2
3
|
import { t as curatedModelOverrides } from "./models-CZjCOjs4.js";
|
|
3
4
|
import { t as synthesizeItemModels } from "./synthesize-jTjVjPAt.js";
|
|
4
|
-
import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-
|
|
5
|
-
import { n as UnsafeJarError, t as JarResourceManager } from "./jar-W2cV2ZVO.js";
|
|
5
|
+
import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-BspVCz2G.js";
|
|
6
6
|
//#region src/mods/prepare.ts
|
|
7
7
|
/**
|
|
8
8
|
* Mod asset composition: mod jars layered under the vanilla base (vanilla wins
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "../entity-fallback-
|
|
1
|
+
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "../entity-fallback-Bth0fa7m.js";
|
|
2
2
|
export { dyeVariantName, dyedVariantTint, renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
|
package/dist/render/face.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "../face-
|
|
1
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "../face-B2JjWT46.js";
|
|
2
2
|
export { createShadeCache, faceMaxZ, renderFace };
|
package/dist/render/geo.d.ts
CHANGED
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
|
|
3
|
-
import { i as TextureLoader } from "../loader-DUlx29PC.js";
|
|
4
|
-
import { n as FloatTexture } from "../blend-eT64Z6qm.js";
|
|
5
|
-
import { n as FaceGeometry } from "../geometry-Bkur58Vi.js";
|
|
6
|
-
import { i as RenderOptions } from "../renderer-C_DFi8DF.js";
|
|
7
|
-
//#region src/render/geo.d.ts
|
|
8
|
-
interface GeoCube {
|
|
9
|
-
origin?: number[];
|
|
10
|
-
size?: number[];
|
|
11
|
-
uv?: number[] | Record<string, {
|
|
12
|
-
uv: number[];
|
|
13
|
-
uv_size?: number[];
|
|
14
|
-
}>;
|
|
15
|
-
inflate?: number;
|
|
16
|
-
pivot?: number[];
|
|
17
|
-
rotation?: number[];
|
|
18
|
-
}
|
|
19
|
-
interface GeoBone {
|
|
20
|
-
name?: string;
|
|
21
|
-
parent?: string;
|
|
22
|
-
pivot?: number[];
|
|
23
|
-
rotation?: number[];
|
|
24
|
-
cubes?: GeoCube[];
|
|
25
|
-
}
|
|
26
|
-
interface GeoDescription {
|
|
27
|
-
texture_width?: number;
|
|
28
|
-
texture_height?: number;
|
|
29
|
-
}
|
|
30
|
-
interface GeoFile {
|
|
31
|
-
'minecraft:geometry'?: Array<{
|
|
32
|
-
description?: GeoDescription;
|
|
33
|
-
bones?: GeoBone[];
|
|
34
|
-
}>;
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
}
|
|
37
|
-
interface ParsedGeo {
|
|
38
|
-
textureWidth: number;
|
|
39
|
-
textureHeight: number;
|
|
40
|
-
bones: GeoBone[];
|
|
41
|
-
}
|
|
42
|
-
/** Handles both the modern (1.12+) and legacy (`geometry.name` keyed) layouts. */
|
|
43
|
-
declare function parseGeo(json: GeoFile): ParsedGeo | null;
|
|
44
|
-
/** Convert a parsed geo into face geometry, unit-cube fitted with gui pose. */
|
|
45
|
-
declare function geoToFaces(geo: ParsedGeo): FaceGeometry[];
|
|
46
|
-
/** Conventional locations GeckoLib mods keep item geometry and textures. */
|
|
47
|
-
declare function findGeoForItem(resources: ResourceManager, id: string): Promise<{
|
|
48
|
-
geo: ParsedGeo;
|
|
49
|
-
texture: ResourceLocator;
|
|
50
|
-
} | null>;
|
|
51
|
-
/** Render a parsed geo with the standard block gui pose. */
|
|
52
|
-
declare function renderGeo(geo: ParsedGeo, texture: ResourceLocator, textures: TextureLoader, options: RenderOptions): Promise<FloatTexture | null>;
|
|
53
|
-
//#endregion
|
|
54
|
-
export { findGeoForItem, geoToFaces, parseGeo, renderGeo };
|
|
1
|
+
import { a as parseGeo, i as nameTokens, n as findGeoForItem, o as renderGeo, r as geoToFaces, t as ParsedGeo } from "../geo-CmjrXu0G.js";
|
|
2
|
+
export { ParsedGeo, findGeoForItem, geoToFaces, nameTokens, parseGeo, renderGeo };
|
package/dist/render/geo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { findGeoForItem, geoToFaces, parseGeo, renderGeo };
|
|
1
|
+
import { a as renderGeo, i as parseGeo, n as geoToFaces, r as nameTokens, t as findGeoForItem } from "../geo-Desq-gRC.js";
|
|
2
|
+
export { findGeoForItem, geoToFaces, nameTokens, parseGeo, renderGeo };
|
package/dist/render/obj.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as renderObjModel, n as parseMtl, r as parseObj, t as materialTexture } from "../obj-
|
|
1
|
+
import { i as renderObjModel, n as parseMtl, r as parseObj, t as materialTexture } from "../obj-CJHEHpki.js";
|
|
2
2
|
export { materialTexture, parseMtl, parseObj, renderObjModel };
|
package/dist/render/pipeline.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-BUIMzMzg.js";
|
|
2
2
|
export { ItemPipeline };
|
package/dist/render/renderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "../obj-
|
|
1
|
+
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "../obj-CJHEHpki.js";
|
|
2
2
|
export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as restoreResources, t as describeResources } from "../descriptor-
|
|
1
|
+
import { n as restoreResources, t as describeResources } from "../descriptor-JyXhfd-c.js";
|
|
2
2
|
export { describeResources, restoreResources };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
+
import { n as discoverItems } from "./discovery-CD0QqxSF.js";
|
|
2
3
|
import { n as LayeredResourceManager } from "./manager-BNibYkmI.js";
|
|
3
4
|
import { t as curatedModelOverrides } from "./models-CZjCOjs4.js";
|
|
4
|
-
import { n as discoverItems } from "./discovery-CsZu08re.js";
|
|
5
5
|
import { r as encodeRasterAsset } from "./encode-LR9wxigC.js";
|
|
6
6
|
import { t as classifyItemStyle } from "./item-styles-DjYRdyHi.js";
|
|
7
7
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
8
8
|
import { t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
|
|
9
|
-
import { t as ItemPipeline } from "./pipeline-
|
|
10
|
-
import { t as describeResources } from "./descriptor-
|
|
9
|
+
import { t as ItemPipeline } from "./pipeline-BUIMzMzg.js";
|
|
10
|
+
import { t as describeResources } from "./descriptor-JyXhfd-c.js";
|
|
11
11
|
import { t as WorkerRenderPool } from "./pool-CKGp1qup.js";
|
|
12
12
|
import path from "node:path";
|
|
13
13
|
import os from "node:os";
|
package/dist/run.js
CHANGED