CraftStudio API 1.12.2, — Guide
Key Features
The API introduces several technical advancements to the Minecraft rendering pipeline:
- Native Format Support: Direct import of
.csjsmodel(models) and.csjsmodelanim(animations) files. - Advanced Animations: Keyframe-based position and rotation animations that are much smoother than hard-coded Java animations.
- Synchronization: A built-in system to ensure animations are perfectly synced between the server and all connected clients.
- Versatility: Supports custom models for both Entities and Blocks (via Tile Entity Special Renderers).
- Loading Feedback: Includes a custom progress bar during the game's startup to track the loading of complex models and animations.
Model System
The API uses a custom JSON-based format exported from CraftStudio. This system allows for more flexible block properties than the standard Minecraft engine.
Supported Model Properties
| Property | Description |
|---|---|
| Position | The X, Y, Z coordinates of the block relative to its parent. |
| Rotation | Euler angles (Yaw, Pitch, Roll) for precise orientation. |
| Size | The dimensions of the cuboid block. |
| Offset | Adjusts the visual position of the block without moving its pivot point. |
| Stretch | Allows for slight scaling adjustments of the model parts. |
Texture Mapping
Currently, the API specifically supports the "Collapsed" unwrap mode for textures. This ensures that textures are applied correctly to the complex hierarchies created in CraftStudio. Modders can use external software to paint textures once the UV map is generated.
Animation System
The animation system is the core of the CraftStudio API, providing a fluid way to bring entities and blocks to life.
- Keyframe Interpolation: The API automatically calculates the movement between defined keyframes for smooth transitions.
- Hold Last Keyframe: A feature that allows an animation to stay in its final pose rather than snapping back to the default state.
- Reverse Animations: Animations can be played backward, which is useful for opening/closing doors or similar mechanical movements.
- Animation Handler: A centralized system (
AnimationHandler) manages which animations are playing on an entity at any given time.
| Feature | Supported | Notes |
|---|---|---|
| Position Animation | Yes | Moves parts over time. |
| Rotation Animation | Yes | Rotates parts around their pivot. |
| Size/Stretch Anim | No | Currently ignored in the animation files. |
| Server Sync | Yes | Animations triggered on server reflect on all clients. |
Mechanics & Technical Specs
The API operates by overriding the standard rendering calls. When a model is loaded, it is stored in a registry that can be accessed by any mod using the API as a dependency.
- File Locations: Models should be placed in
assets/modid/models/craftstudio/and animations inassets/modid/animations/craftstudio/. - Naming Conventions: It is highly recommended that models do not have multiple blocks with the same name, as this can cause conflicts during the animation interpolation process.