Skip to content

Commit

Permalink
Use 1.21.1 and update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Sep 30, 2024
1 parent d24a76c commit 265bb46
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 24 deletions.
60 changes: 41 additions & 19 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,59 +88,81 @@ registerDynamicLightHandler(EntityType.ITEM_FRAME, entity -> {

## Item light sources

By default every items will emit the same amount of light as their assigned block if possible.
By default, every item will emit the same amount of light as their assigned block if possible.

But for items that are not assigned to a block, or for items that should not lit up underwater, there's JSON files to write!
But for items that are not assigned to a block, or for items that should not light up underwater, there's JSON files to write!

The JSONs are located in `<modid>:dynamiclights/item/<file>.json`.
The JSONs are located in `<namespace>:dynamiclights/item/<file>.json`.

### JSON item light source

The format is simple:

- `item` - The identifier of the affected item.
- `luminance` - Either a number between `0` and `15` and corresponds to the luminance value,
or is a string with either a block identifier to get the luminance from
or `"block"` to use the default assigned block luminance value.
- `water_sensitive` *(Optional)* - `true` if the item doesn't emit light when submerged in water, else `false`.
- `match` - The [item predicate](https://minecraft.wiki/w/Template:Nbt_inherit/conditions/item/template) to match the affected items.
- `luminance` - Can either be:
- a number between `0` and `15`, which corresponds to the luminance value.
- an object with a type and arguments, which can be:
- `{ "type": "block", "block": "<block identifier>" }` to copy the luminance value of the specified block.
- `{ "type": "block_self" }` to copy the luminance value of the block already associated with the matched item.
- `water_sensitive` *(Optional)* - `true` if the item doesn't emit light when submerged in water, or `false` otherwise.
- `silence_error` *(Optional)* - `true` to silence any kind of runtime error from the item light source,
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`.

#### Examples

##### `lambdynlights:dynamiclights/item/fire_charge.json`

```json
{
"item": "minecraft:fire_charge",
"luminance": 10,
"water_sensitive": true
"match": {
"items": "minecraft:fire_charge"
},
"luminance": 10,
"water_sensitive": true
}
```

##### `lambdynlights:dynamiclights/item/lava_bucket.json`

```json
{
"item": "minecraft:lava_bucket",
"luminance": "minecraft:lava",
"water_sensitive": true
"match": {
"items": "minecraft:lava_bucket"
},
"luminance": {
"type": "block",
"block": "minecraft:lava"
},
"water_sensitive": true
}
```

##### `lambdynlights:dynamiclights/item/nether_star.json`

```json
{
"item": "minecraft:nether_star",
"luminance": 8
"match": {
"items": "minecraft:nether_star"
},
"luminance": 8
}
```

##### `lambdynlights:dynamiclights/item/torch.json`

```json
{
"item": "minecraft:torch",
"luminance": "block",
"water_sensitive": true
"match": {
"items": [
"minecraft:torch",
"minecraft:redstone_torch",
"minecraft:soul_torch"
]
},
"luminance": {
"type": "block_self"
},
"water_sensitive": true
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
public interface DynamicLightsInitializer {
/**
* Called when LambDynamicLights is initialized to register custom dynamic light handlers and item light sources.
*
* @param itemLightSourceManager the manager for item light sources
*/
void onInitializeDynamicLights(ItemLightSourceManager itemLightSourceManager);
}
2 changes: 1 addition & 1 deletion build_logic/src/main/kotlin/lambdynamiclights.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
@Suppress("UnstableApiUsage")
mappings(loom.layered {
addLayer(MojangMappingsSpec(false))
parchment("org.parchmentmc.data:parchment-${Constants.mcVersion()}:${libs.versions.mappings.parchment.get()}@zip")
parchment("org.parchmentmc.data:parchment-${Constants.getMcVersionString()}:${libs.versions.mappings.parchment.get()}@zip")
mappings("dev.lambdaurora:yalmm:${Constants.mcVersion()}+build.${libs.versions.mappings.yalmm.get()}")
})
modImplementation(libs.fabric.loader)
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
minecraft = "1.21"
minecraft = "1.21.1"
fabric-loader = "0.15.11"
fabric-api = "0.100.4+1.21"
mappings-yalmm = "8"
mappings-parchment = "2024.07.07"
fabric-api = "0.105.0+1.21.1"
mappings-yalmm = "2"
mappings-parchment = "2024.07.28"

# Dependencies
yumi-commons = "1.0.0-alpha.1"
Expand Down

0 comments on commit 265bb46

Please sign in to comment.