Skip to content

Entity shadows in shader packs

Lesson 9.7

With a shader pack, Celestial draws every entity into the pack’s shadow map: mobs, dropped items, falling blocks and your mod’s models cast real shadows. Without a pack nothing changes (entities are lit like in vanilla). A mod can switch shadows off for a type or for one entity, for example for a ghost or a hologram. The guide has the details: Entity Lighting and Shadows.

A whole entity type

#include <clight_easy.h>

static void on_client_setup(void* payload, void* user) {
    (void)payload, (void)user;
    cl_render_set_type_casts_shadow(CL_STR("my_mod:ghost"), false);
}

One entity

/* e: an entity handle you got from an event (CL_SHADOW_DEFAULT puts it back to its type's setting) */
cl_entity_set_casts_shadow(e, CL_SHADOW_NEVER);
bool casts = cl_entity_casts_shadow(e);

What the player chose

The player can switch entity shadows off in Video Settings > Shader Entity Shadows; then nothing casts, whatever a mod says. cl_render_entity_shadows_setting() tells you the setting, cl_render_entity_shadows_active() whether a shader pack draws entity shadows right now.

Recap: a type with render_set_type_casts_shadow, one entity with entity_set_casts_shadow (CL_SHADOW_DEFAULT, NEVER, ALWAYS), and two queries for the player’s setting.