LambdAurora

Entity Lighting

Go back to index

By default, entity lighting is determined by some basics: is the entity on fire? Is the entity holding an item emitting light? Etc. In addition to those basics, LambDynamicLights provide some default entity lighting files.

As good as this is, we might want to make more entities able to emit light under various conditions.

This is where entity lighting JSON come into play. Each file is named as such assets/<namespace>/dynamiclights/entity/<file>.json. While the name doesn't have any constraint aside from the same constraints a resource-pack has (all lowercase, no spaces), it is best practice to name it in a descriptive way or similar to the entities affected by it.

It is possible that multiple files affect the same entities, in which case the file providing the highest light value will win if the conditions are met. You can override an existing file from a mod or another resource-pack through a higher-priority resource-pack.

  1. The Format
    1. match
      1. type
        1. Examples
      2. located
      3. effects
      4. flags
      5. equipment
      6. vehicle
      7. passenger
      8. slots
    2. luminance
    3. silence_error
  2. Luminance Providers
    1. lambdynlights:value
    2. lambdynlights:item
    3. lambdynlights:water_sensitive
    4. lambdynlights:wet_sensitive
    5. Entity-specific Luminance Providers
      1. lambdynlights:display
  3. Examples
    1. lambdynlights:dynamiclights/entity/allay.json
    2. lambdynlights:dynamiclights/entity/blaze.json
    3. Item Frames
      1. lambdynlights:dynamiclights/entity/item_frame.json
      2. lambdynlights:dynamiclights/entity/glow_item_frame.json

The Format

The format of each of the files is the following:

match

This is where you will match the entities to affect. This is very similar to how entity predicates work in advancements, but with a reduced-set of features since this has to work on the client.

This will be defined as a dynamic lighting entity predicate.

type

One or more entity type(s) (an ID, or a tag with #, or an array containing IDs) — Test this entity's type.

Examples

To match a single entity type:

"type": "minecraft:blaze"

To match multiple entity types:

"type": [
	"minecraft:blaze",
	"minecraft:magma_cube",
	"#minecraft:zombies"
]

To match an entity type tag:

"type": "#minecraft:skeletons"

located

This is a location predicate.

    • position - a status effect that must be present
      • x - either an X value or bounds
      • y - either a Y value or bounds
      • z - either a Z value or bounds
    • biomes - the biome at this location. Accepts biome IDs (see Minecraft's Wiki Biome#Biome IDs for the ones used in vanilla) as a single entry or a list. Also accepts a hash-prefixed biome tag.
    • dimension - an ID for the dimension.
    • smokey - true if this location must be smokey, or false if it must not.
    • light - a light predicate, which is either
      • any light
        • any - either a light value between 0 and 15, or bounds.
      • specific
        • block - either a block light value between 0 and 15, or bounds.
        • sky - either a sky light value between 0 and 15, or bounds.
    • can_see_sky - true if this location must be able to see the sky, or false if it must not.

effects

For testing the active status effects on the entity.

From the Minecraft's Wiki:

    • <minecraft:effect_name> - a status effect that must be present
      • amplifier - test the effect's amplifier. Level I is represented by 0. Use an object with min and max to test for a range of values (inclusive).
      • duration - test if the effect's remaining time (in ticks). Test if the effect's remaining time (in ticks) is between two numbers, inclusive. Use an object with min and max to test for a range of values (inclusive).
      • ambient - test whether the effect is from a beacon.
      • visible - test if the effect has visible particles.

flags

To test flags of the entity.

From the Minecraft's Wiki:

    • is_baby - test whether the entity is or is not a baby variant.
    • is_on_fire - test whether the entity is or is not on fire.
    • is_sneaking - test whether the entity is or is not sneaking.
    • is_sprinting - test whether the entity is or is not sprinting.
    • is_swimming - test whether the entity is or is not swimming.
    • is_on_ground - test whether the entity is or is on the ground.
    • is_flying - test whether the entity is or is not flying (with elytra or in creative mode).

equipment

For testing the items that this entity holds in its equipment slots.

    • <equipment slot> - test the item in the entity's equipment slot. Valid keys are mainhand, offhand, head, chest, legs, feet or body.

vehicle

A dynamic lighting entity predicate to match the vehicle of this entity.

passenger

A dynamic lighting entity predicate to match any of the passengers of this entity.

slots

Test for items in specific inventory slots.

luminance

The luminance can either be:

  • a number between 0 and 15 (inclusive), which corresponds to the luminance of the entity;
  • an object with a type and arguments, this means the luminance value will be provided by the specified luminance provider;
  • an array of the previous possibilities.

silence_error

(Default: false)

A boolean value: true to silence any kind of runtime error from this file, this is heavily discouraged unless you know what you're doing as you will not be made aware of errors!

Errors will still be logged if in a development environment or if the lambdynamiclights.resource.force_log_errors property is set to true.

Luminance Providers

lambdynlights:value

Provides a given static luminance value. This luminance provider is implicitely used when a number is provided instead of an object.

    • type: lambdynlights:value
    • value - the value of the luminance between 0 and 15 (inclusive)

lambdynlights:item

Provides the luminance value of the given item.

    • type: lambdynlights:item
    • item - an item, see the Minecraft Wiki for the format
    • include_rain (Default: false) - true if the wetness check should include rain, or false otherwise
    • always (Optional) - let the item be always considered dry (dry) or wet (wet) if present

lambdynlights:water_sensitive

Provides a luminance value depending on whether the entity is out of water or underwater.

    • type: lambdynlights:water_sensitive
    • out_of_water (Optional) - a luminance value or values if the entity is out of water
    • in_water (Optional) - a luminance value or values if the entity is underwater

lambdynlights:wet_sensitive

Provides the luminance value depending on whether the entity is wet or dry.

    • type: lambdynlights:wet_sensitive
    • dry (Optional) - a luminance value or values if the entity is dry
    • wet (Optional) - a luminance value or values if the entity is wet

Entity-specific Luminance Providers

Entity-specific luminance providers only work with the entity they're designed for, if the entity isn't expected they will return 0. Each entity-specific luminance providers have its own behavior with the entity they're targeting for.

Most of them doesn't have any arguments, which results in the following structure:

    • type: lambdynlights:<type name>

Here's a list of the various entity-specific providers and for which entities they're for:

Type Targeted Entities Description
lambdynlights:arrow/item_derived Arrow-like entities (minecraft:arrow, etc.) Uses the luminance of the provided by the item which represents the arrow.
lambdynlights:creeper minecraft:creeper Provides a luminance for a creeper about to explode, this is influenced by LambDynamicLights' creeper lighting setting.
lambdynlights:display/block minecraft:block_display Uses the luminance of the displayed block.
lambdynlights:display/item minecraft:item_display Uses the luminance of the displayed item.
lambdynlights:enderman minecraft:enderman Uses the luminance of the carried block if present.
lambdynlights:falling_block minecraft:falling_block Uses the luminance of the block used to display the falling block.
lambdynlights:glow_squid minecraft:glow_squid Provides a luminance for glow squids depending on their darkness ticks.
lambdynlights:item_entity minecraft:item Uses the luminance of the item representing the entity.
lambdynlights:item_frame minecraft:item_frame Uses the luminance of the item held the entity.
lambdynlights:magma_cube minecraft:magma_cube Provides a luminance for magma cubes depending on their squish state.
lambdynlights:minecart/display_block Minecart-like entities (minecraft:minecart, etc.) Uses the luminance of the display block in the minecart.

lambdynlights:display

This is a luminance providers specific to display entities. Its goal is to provide a nested luminance only if the display entity doesn't have an overriden brightness.

    • type: lambdynlights:display
    • luminance - a luminance value or values if the display entity doesn't have an overridden brightness

Examples

Here are some built-in examples which can be found in the mod:

lambdynlights:dynamiclights/entity/allay.json

{
	"match": {
		"type": "minecraft:allay"
	},
	"luminance": 8
}

lambdynlights:dynamiclights/entity/blaze.json

{
	"match": {
		"type": "minecraft:blaze"
	},
	"luminance": {
		"type": "lambdynlights:wet_sensitive",
		"dry": 10,
		"wet": 4
	}
}

Item Frames

lambdynlights:dynamiclights/entity/item_frame.json

{
	"match": {
		"type": [
			"minecraft:item_frame",
			"minecraft:glow_item_frame"
		]
	},
	"luminance": {
		"type": "lambdynlights:item_frame"
	}
}

lambdynlights:dynamiclights/entity/glow_item_frame.json

{
	"match": {
		"type": "minecraft:glow_item_frame"
	},
	"luminance": 12
}