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:
- Parse
elements[]from the merged Java model JSON. - 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 scale0.625only applies toitem/generated-rooted (flat) models; cuboid models authored without an explicitdisplay.guilook correct at scale 1. - 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.guipivot rotation around (8,8,8), thendisplay.guiscale and translation. - 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).
- 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).