From 265bb4698bbc8c2770837e310c939955a86c07bd Mon Sep 17 00:00:00 2001 From: LambdAurora Date: Mon, 30 Sep 2024 16:16:02 +0200 Subject: [PATCH] Use 1.21.1 and update documentation. --- API.md | 60 +++++++++++++------ .../api/DynamicLightsInitializer.java | 2 + .../main/kotlin/lambdynamiclights.gradle.kts | 2 +- gradle/libs.versions.toml | 8 +-- 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/API.md b/API.md index 3fa822e8..dee84134 100644 --- a/API.md +++ b/API.md @@ -88,21 +88,26 @@ 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 `:dynamiclights/item/.json`. +The JSONs are located in `:dynamiclights/item/.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": "" }` 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 @@ -110,9 +115,11 @@ The format is simple: ```json { - "item": "minecraft:fire_charge", - "luminance": 10, - "water_sensitive": true + "match": { + "items": "minecraft:fire_charge" + }, + "luminance": 10, + "water_sensitive": true } ``` @@ -120,9 +127,14 @@ The format is simple: ```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 } ``` @@ -130,8 +142,10 @@ The format is simple: ```json { - "item": "minecraft:nether_star", - "luminance": 8 + "match": { + "items": "minecraft:nether_star" + }, + "luminance": 8 } ``` @@ -139,8 +153,16 @@ The format is simple: ```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 } ``` diff --git a/api/src/main/java/dev/lambdaurora/lambdynlights/api/DynamicLightsInitializer.java b/api/src/main/java/dev/lambdaurora/lambdynlights/api/DynamicLightsInitializer.java index bb0e2993..9302232e 100644 --- a/api/src/main/java/dev/lambdaurora/lambdynlights/api/DynamicLightsInitializer.java +++ b/api/src/main/java/dev/lambdaurora/lambdynlights/api/DynamicLightsInitializer.java @@ -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); } diff --git a/build_logic/src/main/kotlin/lambdynamiclights.gradle.kts b/build_logic/src/main/kotlin/lambdynamiclights.gradle.kts index 548b616c..29cdf55d 100644 --- a/build_logic/src/main/kotlin/lambdynamiclights.gradle.kts +++ b/build_logic/src/main/kotlin/lambdynamiclights.gradle.kts @@ -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) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ddc70792..75e25ba2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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"