Rendering (function list)
Status: Implemented (API 1.24). Generated from
client/clight/idl/clight_api.jsonbytools/docs/gen_api_reference.py; do not edit by hand. 22 functions, the newest from API 1.20.
Explanations and examples: Rendering, Guide: Entity models and animation. Every function of the render module is listed here in table order.
The details of each function follow the table, in the same order. Side: where the function works (server, client, both). Context: the thread it may be called on (Conventions). Since: the API version that added it.
| C function | Lua | Side | Context | Since |
|---|---|---|---|---|
cl_render_entity_model |
cl.render.entity_model |
both | MAIN | 1.9 |
cl_render_player_animations |
cl.render.player_animations |
both | MAIN | 1.11 |
cl_render_particle_type |
cl.render.particle_type |
both | MAIN | 1.13 |
cl_render_post_pass |
cl.render.post_pass |
client | MAIN | 1.13 |
cl_post_pass_set_uniform |
cl.render.post_pass_set_uniform |
client | ANY | 1.13 |
cl_post_pass_set_enabled |
cl.render.post_pass_set_enabled |
client | ANY | 1.13 |
cl_post_pass_is_enabled |
cl.render.post_pass_is_enabled |
client | ANY | 1.13 |
cl_post_pass_remove |
cl.render.post_pass_remove |
client | MAIN | 1.13 |
cl_render_set_uniform |
cl.render.set_uniform |
client | ANY | 1.13 |
cl_render_set_sky_color |
cl.render.set_sky_color |
client | ANY | 1.13 |
cl_render_set_lightmap_tint |
cl.render.set_lightmap_tint |
client | ANY | 1.13 |
cl_render_set_ambient_darkness |
cl.render.set_ambient_darkness |
client | ANY | 1.13 |
cl_render_clear_overrides |
cl.render.clear_overrides |
client | ANY | 1.13 |
cl_render_item_model |
cl.render.item_model |
both | MAIN | 1.15 |
cl_render_block_model |
cl.render.block_model |
both | MAIN | 1.15 |
cl_render_set_type_casts_shadow |
cl.render.set_type_casts_shadow |
client | ANY | 1.18 |
cl_render_type_casts_shadow |
cl.render.type_casts_shadow |
client | ANY | 1.18 |
cl_render_entity_shadows_setting |
cl.render.entity_shadows_setting |
client | ANY | 1.18 |
cl_render_entity_shadows_active |
cl.render.entity_shadows_active |
client | ANY | 1.18 |
cl_render_emitter_add |
cl.render.emitter_add |
both | TICK | 1.20 |
cl_render_emitter_remove |
cl.render.emitter_remove |
both | TICK | 1.20 |
cl_render_emitter_set_active |
cl.render.emitter_set_active |
both | TICK | 1.20 |
cl_render_entity_model
cl_result cl_render_entity_model(cl_str type, cl_str path, const cl_model_opts* opts, cl_model* out);
Draws every entity of the type with a glTF model instead of its vanilla model (mod types: instead of the fallback; vanilla types: a client-side replacement). Call it on both sides at registration or setup (the server uses the clips for events, root motion and bone positions). Light, overlays (hurt flash), name tags, glowing outlines, fire and shadows work like on vanilla entities. Returns the model.
- Side: both. Context: MAIN (startup (main thread)). Since: API 1.9.
- Lua:
cl.render.entity_model - C++:
clight::render::entity_model(std::string_view type, std::string_view path, const cl_model_opts* opts)→Expected<Model> - The last parameter receives the result. Lua returns it; C++ returns it in
Expected<T>. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_player_animations
cl_result cl_render_player_animations(cl_str path, cl_model* out);
Animation clips for the player model: a glTF file whose nodes are named like the player parts (“head”, “body”, “left_arm”, “right_arm”, “left_leg”, “right_leg”; children like “left_sleeve” or “cape” too), +Y up, +Z forward, the rest pose = the vanilla standing pose. Call it on both sides at setup; then entity_anim_play / anim_layer / anim_stop / anim_state work on players, synced to every Celestial client with CLight. A non-additive layer replaces the vanilla animation of the parts its clip moves (by the layer weight); additive layers add on top of the vanilla walk, look and swing. Several mods can register files; a clip is looked up in every file (registration order).
- Side: both. Context: MAIN (startup (main thread)). Since: API 1.11.
- Lua:
cl.render.player_animations - C++:
clight::render::player_animations(std::string_view path)→Expected<Model> - The last parameter receives the result. Lua returns it; C++ returns it in
Expected<T>. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_particle_type
cl_result cl_render_particle_type(cl_str id, const cl_particle_desc* desc);
Registers a particle type (“my_mod:spark”). Call it on both sides at setup (the server needs the fallback).
- Side: both. Context: MAIN (startup (main thread)). Since: API 1.13.
- Lua:
cl.render.particle_type - C++:
clight::render::particle_type(std::string_view id, const cl_particle_desc* desc)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_post_pass
cl_result cl_render_post_pass(const cl_post_pass_desc* desc, cl_post_pass* out);
- Side: client. Context: MAIN (startup (main thread)). Since: API 1.13.
- Lua:
cl.render.post_pass - C++:
clight::render::post_pass(const cl_post_pass_desc* desc)→Expected<PostPass> - The last parameter receives the result. Lua returns it; C++ returns it in
Expected<T>. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_post_pass_set_uniform
cl_result cl_post_pass_set_uniform(cl_post_pass p, cl_str name, float value);
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.post_pass_set_uniform,post_pass:set_uniform(...) - C++:
PostPass::set_uniform(std::string_view name, float value)→Expected<void>;clight::render::post_pass_set_uniform(PostPass p, std::string_view name, float value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_post_pass_set_enabled
cl_result cl_post_pass_set_enabled(cl_post_pass p, bool enabled);
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.post_pass_set_enabled,post_pass:set_enabled(...) - C++:
PostPass::set_enabled(bool enabled)→Expected<void>;clight::render::post_pass_set_enabled(PostPass p, bool enabled)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_post_pass_is_enabled
bool cl_post_pass_is_enabled(cl_post_pass p);
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.post_pass_is_enabled,post_pass:is_enabled(...) - C++:
PostPass::is_enabled()→bool;clight::render::post_pass_is_enabled(PostPass p)→bool
cl_post_pass_remove
cl_result cl_post_pass_remove(cl_post_pass p);
- Side: client. Context: MAIN (startup (main thread)). Since: API 1.13.
- Lua:
cl.render.post_pass_remove,post_pass:remove(...) - C++:
PostPass::remove()→Expected<void>;clight::render::post_pass_remove(PostPass p)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_set_uniform
cl_result cl_render_set_uniform(cl_str name, float value);
A float shader packs see as uniform float <modid>_<name>;. Packs also get #define MOD_<MODID> for every loaded mod (upper case).
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.set_uniform - C++:
clight::render::set_uniform(std::string_view name, float value)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_set_sky_color
cl_result cl_render_set_sky_color(cl_color rgb, float strength);
The sky colour blended towards rgb by strength (0: vanilla; 1: replaced). Per mod; several mods apply in load order.
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.set_sky_color - C++:
clight::render::set_sky_color(cl_color rgb, float strength)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_set_lightmap_tint
cl_result cl_render_set_lightmap_tint(cl_color rgb, float strength);
The lightmap tinted towards rgb by strength (0: vanilla).
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.set_lightmap_tint - C++:
clight::render::set_lightmap_tint(cl_color rgb, float strength)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_set_ambient_darkness
cl_result cl_render_set_ambient_darkness(float amount);
Ambient darkness 0…1: the lightmap dims like the darkness effect does (0: vanilla).
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.set_ambient_darkness - C++:
clight::render::set_ambient_darkness(float amount)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_clear_overrides
cl_result cl_render_clear_overrides(void);
Clears the calling mod’s sky, lightmap, darkness and shader-pack uniform overrides.
- Side: client. Context: ANY (any thread). Since: API 1.13.
- Lua:
cl.render.clear_overrides - C++:
clight::render::clear_overrides()→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_item_model
cl_result cl_render_item_model(cl_str item, cl_str path, const cl_item_model_opts* opts, cl_model* out);
Draws the item (“minecraft:diamond_sword” or a mod item) with a glTF model in every place an item is drawn: held in first and third person, in the GUI (inventory, hotbar, tooltips), item frames, dropped on the ground, on heads and shelves. Enchantment glint, custom names and the item’s data stay; the vanilla model of the item is not drawn. A later call for the same item replaces the model. Client side (on a dedicated server it only checks the arguments).
- Side: both. Context: MAIN (startup (main thread)). Since: API 1.15.
- Lua:
cl.render.item_model - C++:
clight::render::item_model(std::string_view item, std::string_view path, const cl_item_model_opts* opts)→Expected<Model> - The last parameter receives the result. Lua returns it; C++ returns it in
Expected<T>. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_block_model
cl_result cl_render_block_model(cl_str block, cl_str path, const cl_block_model_opts* opts, cl_model* out);
Draws every block of the type with a glTF model: block entities (“minecraft:chest”, “minecraft:oak_sign”, banners, skulls, …) instead of their vanilla renderer, and any other block (a mod block too) on top of its block model (give such a block an empty block model, {“elements”: []}, to show only the glTF model). Blocks within 64 blocks of the camera draw it, like block entities. Client side (a dedicated server only checks the arguments).
- Side: both. Context: MAIN (startup (main thread)). Since: API 1.15.
- Lua:
cl.render.block_model - C++:
clight::render::block_model(std::string_view block, std::string_view path, const cl_block_model_opts* opts)→Expected<Model> - The last parameter receives the result. Lua returns it; C++ returns it in
Expected<T>. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_set_type_casts_shadow
cl_result cl_render_set_type_casts_shadow(cl_str type, bool casts);
Whether entities of a type (“minecraft:item”, “minecraft:falling_block”, a mod entity type) cast shadows into a shader pack’s shadow map (default true). Per type for every mod (the last call wins); entity_set_casts_shadow overrides it per entity. The player’s Shader Entity Shadows setting still comes first: when it is off nothing casts. CL_E_NOT_FOUND: no such entity type.
- Side: client. Context: ANY (any thread). Since: API 1.18.
- Lua:
cl.render.set_type_casts_shadow - C++:
clight::render::set_type_casts_shadow(std::string_view type, bool casts)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_type_casts_shadow
bool cl_render_type_casts_shadow(cl_str type);
The type’s setting (true unless a mod turned it off; false for an unknown type).
- Side: client. Context: ANY (any thread). Since: API 1.18.
- Lua:
cl.render.type_casts_shadow - C++:
clight::render::type_casts_shadow(std::string_view type)→bool
cl_render_entity_shadows_setting
bool cl_render_entity_shadows_setting(void);
The player’s Video Settings option Shader Entity Shadows (true by default).
- Side: client. Context: ANY (any thread). Since: API 1.18.
- Lua:
cl.render.entity_shadows_setting - C++:
clight::render::entity_shadows_setting()→bool
cl_render_entity_shadows_active
bool cl_render_entity_shadows_active(void);
True while entities cast shadows this frame: a shader pack with a shadow map is on, the pack lets entities cast (shadowEntities / shadowPlayer) and the setting is on.
- Side: client. Context: ANY (any thread). Since: API 1.18.
- Lua:
cl.render.entity_shadows_active - C++:
clight::render::entity_shadows_active()→bool
cl_render_emitter_add
cl_result cl_render_emitter_add(cl_entity e, cl_str type, cl_str bone, const cl_particle_spawn* s, int32_t interval_ticks, cl_emitter* out);
- Side: both. Context: TICK (tick thread). Since: API 1.20.
- Lua:
cl.render.emitter_add,entity:emitter_add(...) - C++:
Entity::render_emitter_add(std::string_view type, std::string_view bone, const cl_particle_spawn* s, int32_t interval_ticks)→Expected<Emitter>;clight::render::emitter_add(Entity e, std::string_view type, std::string_view bone, const cl_particle_spawn* s, int32_t interval_ticks)→Expected<Emitter> - The last parameter receives the result. Lua returns it; C++ returns it in
Expected<T>. - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_emitter_remove
cl_result cl_render_emitter_remove(cl_emitter em);
- Side: both. Context: TICK (tick thread). Since: API 1.20.
- Lua:
cl.render.emitter_remove,emitter:emitter_remove(...) - C++:
Emitter::render_emitter_remove()→Expected<void>;clight::render::emitter_remove(Emitter em)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.
cl_render_emitter_set_active
cl_result cl_render_emitter_set_active(cl_emitter em, bool active);
Pauses (false) or resumes an emitter.
- Side: both. Context: TICK (tick thread). Since: API 1.20.
- Lua:
cl.render.emitter_set_active,emitter:emitter_set_active(...) - C++:
Emitter::render_emitter_set_active(bool active)→Expected<void>;clight::render::emitter_set_active(Emitter em, bool active)→Expected<void> - Returns
CL_OKor an error code (Error codes). Lua raises acl.Erroron failure.