promotional bannermobile promotional banner
premium banner
Library for rendering UV 2D maps to pngs

Description

Pexlib

A server-side rendering library for Hytale that generates isometric PNG previews from .blockymodel files.

What it does

Pexlib reads creature models and textures from Hytale's Assets.zip, renders them as isometric 2D images, and exposes a simple API for other mods to use. It handles the full pipeline: model parsing, texture extraction, face UV mapping (including rotation and mirroring), depth sorting, and isometric projection.

Features

  • Parses .blockymodel JSON files with full node hierarchy support
  • Extracts per-face textures with UV offset, rotation (0/90/180/270), and mirroring
  • Handles negative stretch values (geometry mirroring with correct face swapping)
  • Isometric projection with front-facing camera angle
  • Back-to-front depth sorting for correct occlusion
  • Render caching to avoid redundant work
  • Batch rendering for all creatures in Assets.zip
  • Supports custom/modded .blockymodel files via InputStream API

API Usage

// Render a creature by name
BufferedImage img = PexlibApi.renderCreature("Bear_Grizzly");

// With custom options (size, scale)
RenderOptions opts = RenderOptions.builder().width(256).height(256).scale(4.0).build();
BufferedImage img = PexlibApi.renderCreature("Wolf", opts);

// Cached rendering (returns cached result if available)
BufferedImage img = PexlibApi.getCachedRender("Rat", RenderOptions.defaults());

// List all available creatures
List<String> creatures = PexlibApi.listCreatures();

// Render a custom model from any mod
BlockyModel model = PexlibApi.parseModel(inputStream);
BufferedImage img = PexlibApi.renderModel(model, texturePng, opts);

Asset Structure

Pexlib reads from Hytale's asset system:

  • Models: Common/NPC/{Category}/{CreatureName}/Models/Model.blockymodel
  • Textures: Common/NPC/{Category}/{CreatureName}/Models/Texture.png
  • Model configs: Server/Models/{Category}/{Name}.json

Build

./gradlew build

The shadow JAR is automatically deployed to %APPDATA%/Hytale/UserData/Mods/.

Package

dev.hytalemod.pexlib

Author

uwudwagon