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.hpp>

clight::on<clight::ev::LifecycleClientSetup>([](cl_ev_lifecycle&) {
    clight::render::set_type_casts_shadow("my_mod:ghost", false);
});

One entity

// e: a clight::Entity from an event (CL_SHADOW_DEFAULT puts it back to its type's setting)
e.set_casts_shadow(CL_SHADOW_NEVER);
bool casts = e.casts_shadow();

What the player chose

The player can switch entity shadows off in Video Settings > Shader Entity Shadows; then nothing casts, whatever a mod says. clight::render::entity_shadows_setting() tells you the setting, clight::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.