IconRenderer

public final class IconRenderer

Pure-Java software rasterizer that generates 64x64 inventory icons from Java 3D item models. Replaces the legacy "UV-atlas as icon" placeholder in the generic Bedrock pipeline.

Algorithm summary:

  1. Parse elements[] from the merged Java model JSON.
  2. Read display.gui (rotation/translation/scale), defaulting to Mojang's GUI camera (rotation = [30, 225, 0], no translation, scale = [1, 1, 1]). The vanilla default scale 0.625 only applies to item/generated-rooted (flat) models; cuboid models authored without an explicit display.gui look correct at scale 1.
  3. For each element, build the 8 cube corners in Java's 16-unit space centred at (8, 8, 8). Apply the per-element rotation (around its own origin), then the display.gui pivot rotation around (8,8,8), then display.gui scale and translation.
  4. For each of the 6 faces, back-face cull against -Z and compute the 2D destination quad on the 64x64 canvas (orthographic, 4 px per model unit).
  5. Paint visible faces back-to-front via painter's algorithm using a Java2D AffineTransform that maps the source-texture UV rect to the destination parallelogram. Nearest-neighbour interpolation keeps the pixel-art aesthetic.

UV defaults (when faces.<name>.uv is absent), per-face UV rotation, and the up/down-face flip convention all follow vanilla FaceBakery semantics — the same rules already implemented in defaultFaceUV are mirrored here (the helper itself is private, but the algorithm is straightforward enough to inline).

Functions

Link copied to clipboard
public static boolean renderIcon(JsonObject resolvedModel, File mergedJavaPack, File outputPng)
Renders a 64x64 inventory icon for a Java 3D item model and writes it to outputPng.
Link copied to clipboard
public static boolean writeMissingPlaceholder(File outputPng)
Writes a 64x64 magenta/black missing-texture placeholder PNG (Mojang's 8x8 cell checkerboard).