@nodecraft/rendermite 1.1.0 → 1.1.1

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/cli.js CHANGED
@@ -4,7 +4,7 @@ import { n as LayeredResourceManager, t as FolderResourceManager } from "./manag
4
4
  import { t as curatedModelOverrides } from "./models-BKxGkPS7.js";
5
5
  import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-CebmvjmP.js";
6
6
  import { t as JarResourceManager } from "./jar-D9z-X7tA.js";
7
- import { t as run } from "./run-C6AP3Bn8.js";
7
+ import { t as run } from "./run-D87zIGfr.js";
8
8
  import { t as downloadClientJar } from "./download-D9aARBFp.js";
9
9
  import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS } from "./prepare-Cc8QZ3j0.js";
10
10
  import path from "node:path";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as point
14
14
  import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-3VI_2SNy.js";
15
15
  import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-Bxk-WOzH.js";
16
16
  import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-Lb0ZeILz.js";
17
- import { t as run } from "./run-C6AP3Bn8.js";
17
+ import { t as run } from "./run-D87zIGfr.js";
18
18
  import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-Cc8QZ3j0.js";
19
19
  import { n as prepareModResources } from "./prepare-D56Z-9cg.js";
20
20
  export { AnimatedTexture, AtlasSourceError, DYE_COLORS, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, ItemRenderError, ItemResolutionError, JarResourceManager, LayeredResourceManager, LightingProfile, ModelLoader, ModelResolutionError, ResourceKind, ResourceLocator, TextureLoader, TextureResolutionError, UNKNOWN_MODEL, UnsafeJarError, boxDownscale, builtinDynamicResources, compareVersions, createAtlasResolver, defaultProperties, discoverItems, encodeAnimatedIcon, encodeIcon, eraForVersion, evaluateItemModel, generateStylesheet, isUnsafeEntryPath, itemClass, lightsForProfile, minifyStylesheet, parseAtlasSources, parseTintValue, pointResize, prepareModResources, prepareVersionResources, renderModel, renderModelFrames, resolveItem, resolveTexture, resolveTint, resolveTints, run, salvageJson, toByteTexture, toFloatTexture };
@@ -40,6 +40,8 @@ declare class ItemPipeline {
40
40
  * pipeline's black-icon audit checked exactly this). A real sprite beats
41
41
  * no icon; the fallback is recorded so it is never a silent substitution.
42
42
  */
43
+ /** Whether the game draws this item from an entity model rather than a sprite. */
44
+ private isEntityDrawn;
43
45
  private spriteFallback;
44
46
  /**
45
47
  * A blockstate-named block model, drawn the way a block-entity item renderer
@@ -56,7 +56,17 @@ var ItemPipeline = class ItemPipeline {
56
56
  * pipeline's black-icon audit checked exactly this). A real sprite beats
57
57
  * no icon; the fallback is recorded so it is never a silent substitution.
58
58
  */
59
- async spriteFallback(id) {
59
+ /** Whether the game draws this item from an entity model rather than a sprite. */
60
+ async isEntityDrawn(id) {
61
+ try {
62
+ const [instruction] = await resolveItem(this.resources, id, defaultProperties());
63
+ if (!instruction) return false;
64
+ return (await this.models.load(instruction.model)).builtinParent === "builtin/entity";
65
+ } catch {
66
+ return false;
67
+ }
68
+ }
69
+ async spriteFallback(id, entityDrawn) {
60
70
  const { size, quality } = this.settings;
61
71
  const locator = ResourceLocator.parse(id);
62
72
  const draw = (texture) => {
@@ -67,6 +77,7 @@ var ItemPipeline = class ItemPipeline {
67
77
  const texture = await this.textures.load(new ResourceLocator(locator.namespace, `${directory}/${locator.path}`));
68
78
  if (texture) return draw(texture);
69
79
  }
80
+ if (entityDrawn) return null;
70
81
  const leaf = locator.path.split("/").pop();
71
82
  const candidates = await this.resources.listResources("texture", locator.namespace);
72
83
  for (const prefix of [/^items?\//, /^blocks?\//]) {
@@ -215,7 +226,7 @@ var ItemPipeline = class ItemPipeline {
215
226
  delaysMs: [50],
216
227
  usedFallback: false
217
228
  };
218
- const sprite = await this.spriteFallback(id).catch(() => null);
229
+ const sprite = await this.spriteFallback(id, await this.isEntityDrawn(id)).catch(() => null);
219
230
  if (!sprite) throw err;
220
231
  return {
221
232
  frames: [sprite],
@@ -1,2 +1,2 @@
1
- import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-CJNiQG-1.js";
1
+ import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-Bp6amYz_.js";
2
2
  export { ItemPipeline, ItemRenderOutcome, PipelineSettings, RenderedFrames };
@@ -1,2 +1,2 @@
1
- import { t as ItemPipeline } from "../pipeline-BVYj7OP0.js";
1
+ import { t as ItemPipeline } from "../pipeline-zu_ZjnNc.js";
2
2
  export { ItemPipeline };
@@ -4,7 +4,7 @@ import { r as encodeRasterAsset } from "./encode-LR9wxigC.js";
4
4
  import { t as classifyItemStyle } from "./item-styles-upgEO1yP.js";
5
5
  import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
6
6
  import { t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
7
- import { t as ItemPipeline } from "./pipeline-BVYj7OP0.js";
7
+ import { t as ItemPipeline } from "./pipeline-zu_ZjnNc.js";
8
8
  import { t as describeResources } from "./descriptor-DWebtkI1.js";
9
9
  import { t as WorkerRenderPool } from "./pool-CKGp1qup.js";
10
10
  import path from "node:path";
package/dist/run.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { o as evaluateItemModel } from "./definition-ColsvWrH.js";
2
- import { t as run } from "./run-C6AP3Bn8.js";
2
+ import { t as run } from "./run-D87zIGfr.js";
3
3
  export { evaluateItemModel, run };
@@ -1,5 +1,5 @@
1
1
  import { s as ResourceDescriptor } from "../manager-Cv1NeFyF.js";
2
- import { n as ItemRenderOutcome, r as PipelineSettings } from "../pipeline-CJNiQG-1.js";
2
+ import { n as ItemRenderOutcome, r as PipelineSettings } from "../pipeline-Bp6amYz_.js";
3
3
  //#region src/workers/render-worker.d.ts
4
4
  interface RenderWorkerData {
5
5
  resources: ResourceDescriptor;
@@ -1,4 +1,4 @@
1
- import { t as ItemPipeline } from "../pipeline-BVYj7OP0.js";
1
+ import { t as ItemPipeline } from "../pipeline-zu_ZjnNc.js";
2
2
  import { n as restoreResources } from "../descriptor-DWebtkI1.js";
3
3
  import sharp from "sharp";
4
4
  import { parentPort, workerData } from "node:worker_threads";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodecraft/rendermite",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Minecraft item icon renderer: renders inventory-identical item icons from vanilla and modded assets across game versions, outputting optimized PNG/WebP/AVIF plus CSS and a JSON item library.",
5
5
  "type": "module",
6
6
  "license": "MIT",