From fd1243c13e63f9f650f4032907ff5bd56a63bb3b Mon Sep 17 00:00:00 2001 From: Tschipcraft <78470530+Tschipcraft@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:48:43 +0200 Subject: [PATCH 1/7] Fix ominous item spawners not being parsed - Fixed ominous item spawners not being parsed for light emitting items - Fixed tschipcraft.menu trigger not being enabled in 1.21+ - Updated GitHub workflow to annotate snapshot level and Java 21 support --- .github/workflows/cd.yml | 9 +++++++-- data/dynamiclights/function/install.mcfunction | 1 + .../function/internal/sources/parse/main.mcfunction | 1 + data/dynamiclights/function/reset.mcfunction | 1 + data/dynamiclights/tags/entity_type/parse.json | 3 ++- .../tags/entity_type/single_slot_entities.json | 3 +-- .../functions/internal/sources/parse/main.mcfunction | 1 + .../data/dynamiclights/tags/entity_types/parse.json | 3 ++- .../tags/entity_types/single_slot_entities.json | 3 +-- 9 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index bf72c10..62c4508 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,11 +9,11 @@ on: mc_version: description: 'Minecraft version(s) the data pack runs in (human readable)' required: true - default: '1.17x-1.20x' + default: '1.17x-1.21x' mc_version_range: description: 'Minecraft version(s) the data pack runs in (encoded in version range spec)' required: true - default: '>=1.17 <=1.20.4' + default: '>=1.17 <=1.21' jobs: deploy: @@ -91,6 +91,7 @@ jobs: modrinth-id: 7YjclEGc modrinth-token: ${{ secrets.MODRINTH_TOKEN }} game-versions: ${{ github.event.inputs.mc_version_range }} + game-version-filter: any fail-mode: skip name: "[DP] Release v${{ github.event.inputs.tag }}" @@ -109,6 +110,7 @@ jobs: modrinth-id: 7YjclEGc modrinth-token: ${{ secrets.MODRINTH_TOKEN }} game-versions: ${{ github.event.inputs.mc_version_range }} + game-version-filter: any fail-mode: skip name: "[Mod] Release v${{ github.event.inputs.tag }}" @@ -134,6 +136,7 @@ jobs: curseforge-id: 831385 curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} game-versions: ${{ github.event.inputs.mc_version_range }} + game-version-filter: any fail-mode: skip name: "Release v${{ github.event.inputs.tag }}" @@ -152,6 +155,7 @@ jobs: curseforge-id: 910095 curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} game-versions: ${{ github.event.inputs.mc_version_range }} + game-version-filter: any fail-mode: skip name: "Release v${{ github.event.inputs.tag }}" @@ -163,6 +167,7 @@ jobs: catalogue-fabric(optional){curseforge:667377} midnightlib(optional){curseforge:488090} java: | + Java 21 Java 17 Java 18 loaders: | diff --git a/data/dynamiclights/function/install.mcfunction b/data/dynamiclights/function/install.mcfunction index 1b13d40..91df6e1 100644 --- a/data/dynamiclights/function/install.mcfunction +++ b/data/dynamiclights/function/install.mcfunction @@ -59,6 +59,7 @@ execute unless score $rain_sensitive ts.dl.settings matches -1..2 run scoreboard execute unless score $unlimited ts.dl.settings matches -1..2 run scoreboard players set $unlimited ts.dl.settings 0 scoreboard objectives add tschipcraft.menu trigger +scoreboard players enable @a tschipcraft.menu scoreboard objectives add tvc_ignore dummy diff --git a/data/dynamiclights/function/internal/sources/parse/main.mcfunction b/data/dynamiclights/function/internal/sources/parse/main.mcfunction index 68b2454..37b5a28 100644 --- a/data/dynamiclights/function/internal/sources/parse/main.mcfunction +++ b/data/dynamiclights/function/internal/sources/parse/main.mcfunction @@ -5,6 +5,7 @@ summon armor_stand ~ ~ ~ {UUID:[I;-1030365714,1276464731,-2084950084,-395075115] # Copy NBT data execute as @s[type=minecraft:falling_block] run data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0].id set from entity @s BlockState.Name execute as @s[type=minecraft:block_display] run data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0].id set from entity @s block_state.Name +execute as @s[type=minecraft:ominous_item_spawner] run data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0] set from entity @s item execute as c295ddee-4c15-4e5b-83ba-2fbce873a1d5 run function dynamiclights:internal/sources/parse/main_exec diff --git a/data/dynamiclights/function/reset.mcfunction b/data/dynamiclights/function/reset.mcfunction index 86bdb4b..1fc6361 100644 --- a/data/dynamiclights/function/reset.mcfunction +++ b/data/dynamiclights/function/reset.mcfunction @@ -10,6 +10,7 @@ function dynamiclights:internal/explosion_detection/reset # Reset advancement advancement revoke @a only tschipcraft:menu +scoreboard players enable @a tschipcraft.menu # Reschedule main function schedule function dynamiclights:internal/main 5t diff --git a/data/dynamiclights/tags/entity_type/parse.json b/data/dynamiclights/tags/entity_type/parse.json index ceaec6f..f76dca1 100644 --- a/data/dynamiclights/tags/entity_type/parse.json +++ b/data/dynamiclights/tags/entity_type/parse.json @@ -4,6 +4,7 @@ "replace": false, "values": [ "minecraft:falling_block", - {"id": "minecraft:block_display", "required": false} + {"id": "minecraft:block_display", "required": false}, + {"id": "minecraft:ominous_item_spawner", "required": false} ] } diff --git a/data/dynamiclights/tags/entity_type/single_slot_entities.json b/data/dynamiclights/tags/entity_type/single_slot_entities.json index 1038209..9467ed1 100644 --- a/data/dynamiclights/tags/entity_type/single_slot_entities.json +++ b/data/dynamiclights/tags/entity_type/single_slot_entities.json @@ -7,7 +7,6 @@ "minecraft:item", "minecraft:item_display", "minecraft:item_frame", - "minecraft:glow_item_frame", - {"id": "minecraft:ominous_item_spawner", "required": false} + "minecraft:glow_item_frame" ] } diff --git a/overlay_35/data/dynamiclights/functions/internal/sources/parse/main.mcfunction b/overlay_35/data/dynamiclights/functions/internal/sources/parse/main.mcfunction index 68b2454..37b5a28 100644 --- a/overlay_35/data/dynamiclights/functions/internal/sources/parse/main.mcfunction +++ b/overlay_35/data/dynamiclights/functions/internal/sources/parse/main.mcfunction @@ -5,6 +5,7 @@ summon armor_stand ~ ~ ~ {UUID:[I;-1030365714,1276464731,-2084950084,-395075115] # Copy NBT data execute as @s[type=minecraft:falling_block] run data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0].id set from entity @s BlockState.Name execute as @s[type=minecraft:block_display] run data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0].id set from entity @s block_state.Name +execute as @s[type=minecraft:ominous_item_spawner] run data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0] set from entity @s item execute as c295ddee-4c15-4e5b-83ba-2fbce873a1d5 run function dynamiclights:internal/sources/parse/main_exec diff --git a/overlay_35/data/dynamiclights/tags/entity_types/parse.json b/overlay_35/data/dynamiclights/tags/entity_types/parse.json index 3504c26..5d891a4 100644 --- a/overlay_35/data/dynamiclights/tags/entity_types/parse.json +++ b/overlay_35/data/dynamiclights/tags/entity_types/parse.json @@ -4,6 +4,7 @@ "replace": false, "values": [ "minecraft:falling_block", - {"id": "minecraft:block_display", "required": false} + {"id": "minecraft:block_display", "required": false}, + {"id": "minecraft:ominous_item_spawner", "required": false} ] } diff --git a/overlay_35/data/dynamiclights/tags/entity_types/single_slot_entities.json b/overlay_35/data/dynamiclights/tags/entity_types/single_slot_entities.json index 1038209..9467ed1 100644 --- a/overlay_35/data/dynamiclights/tags/entity_types/single_slot_entities.json +++ b/overlay_35/data/dynamiclights/tags/entity_types/single_slot_entities.json @@ -7,7 +7,6 @@ "minecraft:item", "minecraft:item_display", "minecraft:item_frame", - "minecraft:glow_item_frame", - {"id": "minecraft:ominous_item_spawner", "required": false} + "minecraft:glow_item_frame" ] } From 51c1eb97ba4f7c460d9adb1874a98c47997d07a3 Mon Sep 17 00:00:00 2001 From: Tschipcraft <78470530+Tschipcraft@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:56:08 +0200 Subject: [PATCH 2/7] Add Curios API support Added Curios API support (closes #52) Detects both Curios API and Curios API Continuation --- .../function/internal/sources/core.mcfunction | 4 ++++ .../mod_support/curios/iterate_items.mcfunction | 12 ++++++++++++ .../curios/iterate_stacks.mcfunction | 7 +++++++ .../sources/mod_support/curios/main.mcfunction | 12 ++++++++++++ .../sources/mod_support/curios/parse.mcfunction | 17 +++++++++++++++++ .../mod_support/curios/trigger_forge.mcfunction | 7 +++++++ .../curios/trigger_neoforge.mcfunction | 7 +++++++ .../internal/version_checker/start.mcfunction | 5 +++++ data/dynamiclights/function/reset.mcfunction | 4 ++++ .../dynamiclights/function/uninstall.mcfunction | 3 +++ .../functions/internal/sources/core.mcfunction | 4 ++++ .../mod_support/curios/iterate_items.mcfunction | 12 ++++++++++++ .../curios/iterate_stacks.mcfunction | 7 +++++++ .../sources/mod_support/curios/main.mcfunction | 12 ++++++++++++ .../sources/mod_support/curios/parse.mcfunction | 17 +++++++++++++++++ .../mod_support/curios/trigger_forge.mcfunction | 7 +++++++ .../curios/trigger_neoforge.mcfunction | 7 +++++++ .../internal/version_checker/start.mcfunction | 5 +++++ data/dynamiclights/functions/reset.mcfunction | 4 ++++ .../functions/uninstall.mcfunction | 3 +++ 20 files changed, 156 insertions(+) create mode 100644 data/dynamiclights/function/internal/sources/mod_support/curios/iterate_items.mcfunction create mode 100644 data/dynamiclights/function/internal/sources/mod_support/curios/iterate_stacks.mcfunction create mode 100644 data/dynamiclights/function/internal/sources/mod_support/curios/main.mcfunction create mode 100644 data/dynamiclights/function/internal/sources/mod_support/curios/parse.mcfunction create mode 100644 data/dynamiclights/function/internal/sources/mod_support/curios/trigger_forge.mcfunction create mode 100644 data/dynamiclights/function/internal/sources/mod_support/curios/trigger_neoforge.mcfunction create mode 100644 data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_items.mcfunction create mode 100644 data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_stacks.mcfunction create mode 100644 data/dynamiclights/functions/internal/sources/mod_support/curios/main.mcfunction create mode 100644 data/dynamiclights/functions/internal/sources/mod_support/curios/parse.mcfunction create mode 100644 data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_forge.mcfunction create mode 100644 data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_neoforge.mcfunction diff --git a/data/dynamiclights/function/internal/sources/core.mcfunction b/data/dynamiclights/function/internal/sources/core.mcfunction index 636fc7b..79ea75a 100644 --- a/data/dynamiclights/function/internal/sources/core.mcfunction +++ b/data/dynamiclights/function/internal/sources/core.mcfunction @@ -2,6 +2,10 @@ # Dispatches dynamic light around the world # @s - entity that may emit light +# Curios Compatibility +execute if score $curios_install ts.dl.version matches 1 if data entity @s ForgeCaps.curios:inventory.Curios[0] run function dynamiclights:internal/sources/mod_support/curios/trigger_forge +execute if score $curios_install ts.dl.version matches 1 if data entity @s neoforge:attachments.curios:inventory.Curios[0] run function dynamiclights:internal/sources/mod_support/curios/trigger_neoforge + # These entities use a different NBT tag for storing the item and need special parsing (since 24w11a these are only falling blocks and block displays) execute as @s[type=#dynamiclights:parse] unless score @s ts.dl.i.type matches 0..15 run function dynamiclights:internal/sources/parse/main diff --git a/data/dynamiclights/function/internal/sources/mod_support/curios/iterate_items.mcfunction b/data/dynamiclights/function/internal/sources/mod_support/curios/iterate_items.mcfunction new file mode 100644 index 0000000..ca1f7c8 --- /dev/null +++ b/data/dynamiclights/function/internal/sources/mod_support/curios/iterate_items.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Iterates over all items in the current stack + +# Check if item renders +execute store result score curios.render ts.dl.temp run data get storage dynamiclights:curios stacks[0].StacksHandler.Renders.Renders[0].Render + +# Parse item and advance to next +execute if score curios.render ts.dl.temp matches 1 run function dynamiclights:internal/sources/mod_support/curios/parse +data remove storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] +data remove storage dynamiclights:curios stacks[0].StacksHandler.Renders.Renders[0] + +execute if data storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] run function dynamiclights:internal/sources/mod_support/curios/iterate_items diff --git a/data/dynamiclights/function/internal/sources/mod_support/curios/iterate_stacks.mcfunction b/data/dynamiclights/function/internal/sources/mod_support/curios/iterate_stacks.mcfunction new file mode 100644 index 0000000..ed06e6f --- /dev/null +++ b/data/dynamiclights/function/internal/sources/mod_support/curios/iterate_stacks.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +# Iterate over all stacks added by Curios +execute if data storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] run function dynamiclights:internal/sources/mod_support/curios/iterate_items +data remove storage dynamiclights:curios stacks[0] + +execute if data storage dynamiclights:curios stacks[0] run function dynamiclights:internal/sources/mod_support/curios/iterate_stacks diff --git a/data/dynamiclights/function/internal/sources/mod_support/curios/main.mcfunction b/data/dynamiclights/function/internal/sources/mod_support/curios/main.mcfunction new file mode 100644 index 0000000..cb4eb93 --- /dev/null +++ b/data/dynamiclights/function/internal/sources/mod_support/curios/main.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft + +# Reset scores from previous tick +scoreboard players reset @s ts.dl.i.type +scoreboard players reset @s ts.dl.i.is_ench +scoreboard players reset @s ts.dl.i.is_ameth +scoreboard players reset @s ts.dl.i.is_firea +scoreboard players reset @s ts.dl.i.is_ript +scoreboard players reset @s ts.dl.i.is_chann + +# Call iterated stack function +function dynamiclights:internal/sources/mod_support/curios/iterate_stacks diff --git a/data/dynamiclights/function/internal/sources/mod_support/curios/parse.mcfunction b/data/dynamiclights/function/internal/sources/mod_support/curios/parse.mcfunction new file mode 100644 index 0000000..668a8aa --- /dev/null +++ b/data/dynamiclights/function/internal/sources/mod_support/curios/parse.mcfunction @@ -0,0 +1,17 @@ +##by Tschipcraft + +summon armor_stand ~ ~ ~ {UUID:[I;-1030365714,1276464731,-2084950084,-395075115],NoGravity:1b,Silent:1b,Invulnerable:1b,Small:1b,Marker:1b,Invisible:1b,NoBasePlate:1b,Tags:["ts.dl.i.parser"],HandItems:[{id:"minecraft:structure_void",Count:1b},{}],DisabledSlots:4144959} + +# Copy NBT data +data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0] set from storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] +data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[1] set from storage dynamiclights:curios stacks[0].StacksHandler.Cosmetics.Items[0] + +execute as c295ddee-4c15-4e5b-83ba-2fbce873a1d5 run function dynamiclights:internal/sources/parse/main_exec + +# Transfer scores +scoreboard players operation @s ts.dl.i.type = .global ts.dl.i.type +scoreboard players operation @s ts.dl.i.is_ench = .global ts.dl.i.is_ench +scoreboard players operation @s ts.dl.i.is_ameth = .global ts.dl.i.is_ameth +scoreboard players operation @s ts.dl.i.is_firea = .global ts.dl.i.is_firea +scoreboard players operation @s ts.dl.i.is_ript = .global ts.dl.i.is_ript +scoreboard players operation @s ts.dl.i.is_chann = .global ts.dl.i.is_chann diff --git a/data/dynamiclights/function/internal/sources/mod_support/curios/trigger_forge.mcfunction b/data/dynamiclights/function/internal/sources/mod_support/curios/trigger_forge.mcfunction new file mode 100644 index 0000000..0915424 --- /dev/null +++ b/data/dynamiclights/function/internal/sources/mod_support/curios/trigger_forge.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +# Copy to cache +data modify storage dynamiclights:curios stacks set from entity @s ForgeCaps.curios:inventory.Curios + +# Call main +function dynamiclights:internal/sources/mod_support/curios/main diff --git a/data/dynamiclights/function/internal/sources/mod_support/curios/trigger_neoforge.mcfunction b/data/dynamiclights/function/internal/sources/mod_support/curios/trigger_neoforge.mcfunction new file mode 100644 index 0000000..abd53a6 --- /dev/null +++ b/data/dynamiclights/function/internal/sources/mod_support/curios/trigger_neoforge.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +# Copy to cache +data modify storage dynamiclights:curios stacks set from entity @s neoforge:attachments.curios:inventory.Curios + +# Call main +function dynamiclights:internal/sources/mod_support/curios/main diff --git a/data/dynamiclights/function/internal/version_checker/start.mcfunction b/data/dynamiclights/function/internal/version_checker/start.mcfunction index b533ba6..08017b9 100644 --- a/data/dynamiclights/function/internal/version_checker/start.mcfunction +++ b/data/dynamiclights/function/internal/version_checker/start.mcfunction @@ -4,4 +4,9 @@ scoreboard objectives add ts.dl.version dummy execute store result score $global ts.dl.version run data get entity @r DataVersion execute unless score $global tvc_ignore matches 1 if score $global ts.dl.version matches 4000.. run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"?","bold":true,"color":"gold"},{"text":" Future unknown Minecraft version above 1.21 detected! This data pack/mod may not work correctly anymore! Please make sure to check for updates in the menu! (","color":"gold"},{"text":"/trigger tschipcraft.menu","underlined":true,"color":"gold","clickEvent":{"action":"run_command","value":"/trigger tschipcraft.menu"},"hoverEvent":{"action":"show_text","contents":"Click here"}},{"text":")","color":"gold"}] +# Curios Compatibility +scoreboard players reset $curios_install ts.dl.version +execute if data entity @r ForgeCaps.curios:inventory.Curios run scoreboard players set $curios_install ts.dl.version 1 +execute if data entity @r neoforge:attachments.curios:inventory.Curios run scoreboard players set $curios_install ts.dl.version 1 + execute unless score $global ts.dl.version matches 1.. run function dynamiclights:internal/version_checker/retry diff --git a/data/dynamiclights/function/reset.mcfunction b/data/dynamiclights/function/reset.mcfunction index 1fc6361..c282782 100644 --- a/data/dynamiclights/function/reset.mcfunction +++ b/data/dynamiclights/function/reset.mcfunction @@ -12,6 +12,10 @@ function dynamiclights:internal/explosion_detection/reset advancement revoke @a only tschipcraft:menu scoreboard players enable @a tschipcraft.menu +# Reset parsed data +scoreboard objectives remove ts.dl.i.type +scoreboard objectives add ts.dl.i.type dummy + # Reschedule main function schedule function dynamiclights:internal/main 5t diff --git a/data/dynamiclights/function/uninstall.mcfunction b/data/dynamiclights/function/uninstall.mcfunction index 1ba6b27..05ab816 100644 --- a/data/dynamiclights/function/uninstall.mcfunction +++ b/data/dynamiclights/function/uninstall.mcfunction @@ -30,6 +30,9 @@ scoreboard objectives remove tschipcraft.menu scoreboard objectives remove ts.dl.version scoreboard objectives remove tvc_ignore +# Clear storage +data remove storage dynamiclights:curios stacks + # Clear schedules schedule clear dynamiclights:internal/main diff --git a/data/dynamiclights/functions/internal/sources/core.mcfunction b/data/dynamiclights/functions/internal/sources/core.mcfunction index 636fc7b..79ea75a 100644 --- a/data/dynamiclights/functions/internal/sources/core.mcfunction +++ b/data/dynamiclights/functions/internal/sources/core.mcfunction @@ -2,6 +2,10 @@ # Dispatches dynamic light around the world # @s - entity that may emit light +# Curios Compatibility +execute if score $curios_install ts.dl.version matches 1 if data entity @s ForgeCaps.curios:inventory.Curios[0] run function dynamiclights:internal/sources/mod_support/curios/trigger_forge +execute if score $curios_install ts.dl.version matches 1 if data entity @s neoforge:attachments.curios:inventory.Curios[0] run function dynamiclights:internal/sources/mod_support/curios/trigger_neoforge + # These entities use a different NBT tag for storing the item and need special parsing (since 24w11a these are only falling blocks and block displays) execute as @s[type=#dynamiclights:parse] unless score @s ts.dl.i.type matches 0..15 run function dynamiclights:internal/sources/parse/main diff --git a/data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_items.mcfunction b/data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_items.mcfunction new file mode 100644 index 0000000..ca1f7c8 --- /dev/null +++ b/data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_items.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Iterates over all items in the current stack + +# Check if item renders +execute store result score curios.render ts.dl.temp run data get storage dynamiclights:curios stacks[0].StacksHandler.Renders.Renders[0].Render + +# Parse item and advance to next +execute if score curios.render ts.dl.temp matches 1 run function dynamiclights:internal/sources/mod_support/curios/parse +data remove storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] +data remove storage dynamiclights:curios stacks[0].StacksHandler.Renders.Renders[0] + +execute if data storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] run function dynamiclights:internal/sources/mod_support/curios/iterate_items diff --git a/data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_stacks.mcfunction b/data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_stacks.mcfunction new file mode 100644 index 0000000..ed06e6f --- /dev/null +++ b/data/dynamiclights/functions/internal/sources/mod_support/curios/iterate_stacks.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +# Iterate over all stacks added by Curios +execute if data storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] run function dynamiclights:internal/sources/mod_support/curios/iterate_items +data remove storage dynamiclights:curios stacks[0] + +execute if data storage dynamiclights:curios stacks[0] run function dynamiclights:internal/sources/mod_support/curios/iterate_stacks diff --git a/data/dynamiclights/functions/internal/sources/mod_support/curios/main.mcfunction b/data/dynamiclights/functions/internal/sources/mod_support/curios/main.mcfunction new file mode 100644 index 0000000..cb4eb93 --- /dev/null +++ b/data/dynamiclights/functions/internal/sources/mod_support/curios/main.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft + +# Reset scores from previous tick +scoreboard players reset @s ts.dl.i.type +scoreboard players reset @s ts.dl.i.is_ench +scoreboard players reset @s ts.dl.i.is_ameth +scoreboard players reset @s ts.dl.i.is_firea +scoreboard players reset @s ts.dl.i.is_ript +scoreboard players reset @s ts.dl.i.is_chann + +# Call iterated stack function +function dynamiclights:internal/sources/mod_support/curios/iterate_stacks diff --git a/data/dynamiclights/functions/internal/sources/mod_support/curios/parse.mcfunction b/data/dynamiclights/functions/internal/sources/mod_support/curios/parse.mcfunction new file mode 100644 index 0000000..668a8aa --- /dev/null +++ b/data/dynamiclights/functions/internal/sources/mod_support/curios/parse.mcfunction @@ -0,0 +1,17 @@ +##by Tschipcraft + +summon armor_stand ~ ~ ~ {UUID:[I;-1030365714,1276464731,-2084950084,-395075115],NoGravity:1b,Silent:1b,Invulnerable:1b,Small:1b,Marker:1b,Invisible:1b,NoBasePlate:1b,Tags:["ts.dl.i.parser"],HandItems:[{id:"minecraft:structure_void",Count:1b},{}],DisabledSlots:4144959} + +# Copy NBT data +data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0] set from storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0] +data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[1] set from storage dynamiclights:curios stacks[0].StacksHandler.Cosmetics.Items[0] + +execute as c295ddee-4c15-4e5b-83ba-2fbce873a1d5 run function dynamiclights:internal/sources/parse/main_exec + +# Transfer scores +scoreboard players operation @s ts.dl.i.type = .global ts.dl.i.type +scoreboard players operation @s ts.dl.i.is_ench = .global ts.dl.i.is_ench +scoreboard players operation @s ts.dl.i.is_ameth = .global ts.dl.i.is_ameth +scoreboard players operation @s ts.dl.i.is_firea = .global ts.dl.i.is_firea +scoreboard players operation @s ts.dl.i.is_ript = .global ts.dl.i.is_ript +scoreboard players operation @s ts.dl.i.is_chann = .global ts.dl.i.is_chann diff --git a/data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_forge.mcfunction b/data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_forge.mcfunction new file mode 100644 index 0000000..0915424 --- /dev/null +++ b/data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_forge.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +# Copy to cache +data modify storage dynamiclights:curios stacks set from entity @s ForgeCaps.curios:inventory.Curios + +# Call main +function dynamiclights:internal/sources/mod_support/curios/main diff --git a/data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_neoforge.mcfunction b/data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_neoforge.mcfunction new file mode 100644 index 0000000..abd53a6 --- /dev/null +++ b/data/dynamiclights/functions/internal/sources/mod_support/curios/trigger_neoforge.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +# Copy to cache +data modify storage dynamiclights:curios stacks set from entity @s neoforge:attachments.curios:inventory.Curios + +# Call main +function dynamiclights:internal/sources/mod_support/curios/main diff --git a/data/dynamiclights/functions/internal/version_checker/start.mcfunction b/data/dynamiclights/functions/internal/version_checker/start.mcfunction index 597c579..b7a2bef 100644 --- a/data/dynamiclights/functions/internal/version_checker/start.mcfunction +++ b/data/dynamiclights/functions/internal/version_checker/start.mcfunction @@ -10,4 +10,9 @@ execute if score $global ts.dl.version matches 1977..2230 run tellraw @a [{"text execute if score $global ts.dl.version matches 1632..1976 run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.14","color":"red","bold": true},{"text":" detected! This data pack does not work in 1.14! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":true},{"text":"!","color":"red"}] execute if score $global ts.dl.version matches 1343..1631 run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.13","color":"red","bold": true},{"text":" detected! This data pack does not work in 1.13! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":true},{"text":"!","color":"red"}] +# Curios Compatibility +scoreboard players reset $curios_install ts.dl.version +execute if data entity @r ForgeCaps.curios:inventory.Curios run scoreboard players set $curios_install ts.dl.version 1 +execute if data entity @r neoforge:attachments.curios:inventory.Curios run scoreboard players set $curios_install ts.dl.version 1 + execute unless score $global ts.dl.version matches 1.. run function dynamiclights:internal/version_checker/retry diff --git a/data/dynamiclights/functions/reset.mcfunction b/data/dynamiclights/functions/reset.mcfunction index e30ed81..7ba5f98 100644 --- a/data/dynamiclights/functions/reset.mcfunction +++ b/data/dynamiclights/functions/reset.mcfunction @@ -11,6 +11,10 @@ function dynamiclights:internal/explosion_detection/reset # Reset advancement advancement revoke @a only dynamiclights:interacted_with_item_frame +# Reset parsed data +scoreboard objectives remove ts.dl.i.type +scoreboard objectives add ts.dl.i.type dummy + # Reschedule functions schedule function dynamiclights:internal/main 5t schedule function dynamiclights:internal/loop 4t diff --git a/data/dynamiclights/functions/uninstall.mcfunction b/data/dynamiclights/functions/uninstall.mcfunction index 4ba8aa2..c4a7616 100644 --- a/data/dynamiclights/functions/uninstall.mcfunction +++ b/data/dynamiclights/functions/uninstall.mcfunction @@ -30,6 +30,9 @@ scoreboard objectives remove tschipcraft.menu scoreboard objectives remove ts.dl.version scoreboard objectives remove tvc_ignore +# Clear storage +data remove storage dynamiclights:curios stacks + # Clear schedules schedule clear dynamiclights:internal/main schedule clear dynamiclights:internal/loop From f80f58e2e34cb9dd8e2711fbd67f45f118197e7b Mon Sep 17 00:00:00 2001 From: Tschipcraft <78470530+Tschipcraft@users.noreply.github.com> Date: Wed, 28 Aug 2024 12:20:00 +0200 Subject: [PATCH 3/7] Fix stops working on paper servers after some time Moved schedule command to beginning of main. This should theoretically fix Dynamic Lights breaking after some time on paper servers (closes #45, closes #21) --- data/dynamiclights/function/internal/main.mcfunction | 6 +++--- data/dynamiclights/functions/internal/main.mcfunction | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/dynamiclights/function/internal/main.mcfunction b/data/dynamiclights/function/internal/main.mcfunction index e176127..f7dbe50 100644 --- a/data/dynamiclights/function/internal/main.mcfunction +++ b/data/dynamiclights/function/internal/main.mcfunction @@ -1,5 +1,8 @@ ## by Tschipcraft +# Schedule for next tick +schedule function dynamiclights:internal/main 1t + # Tag old lights tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove @@ -11,6 +14,3 @@ execute unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights # Clear old lights execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamiclights:internal/remove_light - -# Repeat -schedule function dynamiclights:internal/main 1t diff --git a/data/dynamiclights/functions/internal/main.mcfunction b/data/dynamiclights/functions/internal/main.mcfunction index 0cbdf1e..4bcf1c6 100644 --- a/data/dynamiclights/functions/internal/main.mcfunction +++ b/data/dynamiclights/functions/internal/main.mcfunction @@ -1,5 +1,8 @@ ## by Tschipcraft +# Schedule for next tick +schedule function dynamiclights:internal/main 1t + # Tag old lights tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove @@ -14,6 +17,3 @@ execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamic # Menu function dynamiclights:internal/menu - -# Repeat -schedule function dynamiclights:internal/main 1t From fdbece306655d8843f5fd1d73b6ead46722150d5 Mon Sep 17 00:00:00 2001 From: Tschipcraft <78470530+Tschipcraft@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:54:47 +0200 Subject: [PATCH 4/7] Add mod support for Lucky's Wardrobe Requested by uuretch on CurseForge --- data/dynamiclights/tags/item/mod_support/light_level/15.json | 3 ++- data/dynamiclights/tags/item/mod_support/light_level/9.json | 3 ++- data/dynamiclights/tags/items/mod_support/light_level/15.json | 3 ++- data/dynamiclights/tags/items/mod_support/light_level/9.json | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/data/dynamiclights/tags/item/mod_support/light_level/15.json b/data/dynamiclights/tags/item/mod_support/light_level/15.json index df9292f..3d91f31 100644 --- a/data/dynamiclights/tags/item/mod_support/light_level/15.json +++ b/data/dynamiclights/tags/item/mod_support/light_level/15.json @@ -3,6 +3,7 @@ "replace": false, "values": [ {"id": "#c:lanterns", "required": false}, - {"id": "#c:lava_buckets", "required": false} + {"id": "#c:lava_buckets", "required": false}, + {"id": "wardrobe:lantern_on_a_stick", "required": false} ] } diff --git a/data/dynamiclights/tags/item/mod_support/light_level/9.json b/data/dynamiclights/tags/item/mod_support/light_level/9.json index cb0a667..a628ff7 100644 --- a/data/dynamiclights/tags/item/mod_support/light_level/9.json +++ b/data/dynamiclights/tags/item/mod_support/light_level/9.json @@ -4,6 +4,7 @@ "values": [ {"id": "#c:glow_berries", "required": false}, {"id": "#c:glowstone_dusts", "required": false}, - {"id": "#forge:rods/blaze", "required": false} + {"id": "#forge:rods/blaze", "required": false}, + {"id": "wardrobe:soul_lantern_on_a_stick", "required": false} ] } diff --git a/data/dynamiclights/tags/items/mod_support/light_level/15.json b/data/dynamiclights/tags/items/mod_support/light_level/15.json index df9292f..3d91f31 100644 --- a/data/dynamiclights/tags/items/mod_support/light_level/15.json +++ b/data/dynamiclights/tags/items/mod_support/light_level/15.json @@ -3,6 +3,7 @@ "replace": false, "values": [ {"id": "#c:lanterns", "required": false}, - {"id": "#c:lava_buckets", "required": false} + {"id": "#c:lava_buckets", "required": false}, + {"id": "wardrobe:lantern_on_a_stick", "required": false} ] } diff --git a/data/dynamiclights/tags/items/mod_support/light_level/9.json b/data/dynamiclights/tags/items/mod_support/light_level/9.json index cb0a667..a628ff7 100644 --- a/data/dynamiclights/tags/items/mod_support/light_level/9.json +++ b/data/dynamiclights/tags/items/mod_support/light_level/9.json @@ -4,6 +4,7 @@ "values": [ {"id": "#c:glow_berries", "required": false}, {"id": "#c:glowstone_dusts", "required": false}, - {"id": "#forge:rods/blaze", "required": false} + {"id": "#forge:rods/blaze", "required": false}, + {"id": "wardrobe:soul_lantern_on_a_stick", "required": false} ] } From 289a8bf98f13f5bb3ec92177a9c58b365c55803b Mon Sep 17 00:00:00 2001 From: Tschipcraft <78470530+Tschipcraft@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:56:55 +0200 Subject: [PATCH 5/7] Add global toggle Added global toggle for Dynamic Lights (closes #56) --- CHANGES.md | 12 ++++++------ assets/dynamiclights/lang/en_us.json | 2 ++ .../dynamiclights/function/install.mcfunction | 1 + .../function/internal/main.mcfunction | 2 +- .../function/settings/core.mcfunction | 7 +++++++ .../settings/toggle_enable.mcfunction | 8 ++++++++ .../functions/install.mcfunction | 1 + .../functions/internal/main.mcfunction | 2 +- .../functions/settings/core.mcfunction | 7 +++++++ .../settings/toggle_enable.mcfunction | 8 ++++++++ .../dynamiclights/fabric/Config.class | Bin 1888 -> 1937 bytes .../dynamiclights/fabric/Init.class | Bin 2675 -> 2675 bytes .../dynamiclights/fabric/sendConfig.class | Bin 6774 -> 7190 bytes .../dynamiclights/forge/Config.class | Bin 1908 -> 1957 bytes .../dynamiclights/forge/Init$1.class | Bin 1485 -> 1485 bytes .../dynamiclights/forge/Init.class | Bin 4499 -> 4499 bytes .../dynamiclights/forge/sendConfig.class | Bin 6782 -> 7198 bytes .../dynamiclights/fabric/Config.java | 3 +++ .../dynamiclights/fabric/sendConfig.java | 9 +++++++++ .../dynamiclights/forge/Config.java | 3 +++ .../dynamiclights/forge/sendConfig.java | 9 +++++++++ 21 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 data/dynamiclights/function/settings/toggle_enable.mcfunction create mode 100644 data/dynamiclights/functions/settings/toggle_enable.mcfunction diff --git a/CHANGES.md b/CHANGES.md index d232dad..587eb02 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ -- **Support for Minecraft 1.21** ⚔️ (closes [#29](https://github.com/Tschipcraft/dynamiclights/issues/29), [#41](https://github.com/Tschipcraft/dynamiclights/issues/41), [#42](https://github.com/Tschipcraft/dynamiclights/issues/42), [#44](https://github.com/Tschipcraft/dynamiclights/issues/44)) - - Copied the contents of the legacy folders to their new names and removed unused code - - Used new enchantment check format in predicates - - Updated menu trigger to use advancements instead and added menu message header -- Fixed performance overlay for Minecraft 1.20.2+ not having an effect -- Updated LICENSE +- Added Curios API and Curios API Continuation support (closes [#52](https://github.com/Tschipcraft/dynamiclights/issues/52)) +- Added global toggle for Dynamic Lights (closes [#56](https://github.com/Tschipcraft/dynamiclights/issues/56)) +- Added mod support for Lucky's Wardrobe +- Fixed ominous item spawners not being parsed for light emitting items +- Fixed Dynamic Lights breaking after some time on paper servers (closes [#45](https://github.com/Tschipcraft/dynamiclights/issues/45), closes [#21](https://github.com/Tschipcraft/dynamiclights/issues/21)) +- Fixed tschipcraft.menu trigger not being enabled in 1.21+ diff --git a/assets/dynamiclights/lang/en_us.json b/assets/dynamiclights/lang/en_us.json index 531831a..0108ebc 100644 --- a/assets/dynamiclights/lang/en_us.json +++ b/assets/dynamiclights/lang/en_us.json @@ -12,6 +12,8 @@ "dynamiclights.midnightconfig.empty3": "", "dynamiclights.midnightconfig.other": "§lOther", + "dynamiclights.midnightconfig.enable": "Dynamic Lights", + "dynamiclights.midnightconfig.enable.tooltip": "Enable Dynamic Lights\nDefault: §aYes§f", "dynamiclights.midnightconfig.enable_on_fire": "Burning entities", "dynamiclights.midnightconfig.enable_on_fire.tooltip": "Default: §aYes§f", "dynamiclights.midnightconfig.enable_glowing": "Entities with the glowing potion effect", diff --git a/data/dynamiclights/function/install.mcfunction b/data/dynamiclights/function/install.mcfunction index 91df6e1..1198a08 100644 --- a/data/dynamiclights/function/install.mcfunction +++ b/data/dynamiclights/function/install.mcfunction @@ -42,6 +42,7 @@ scoreboard objectives add ts.dl.temp dummy scoreboard objectives add ts.dl.settings dummy # defaults +execute unless score $enable ts.dl.settings matches -1..2 run scoreboard players set $enable ts.dl.settings 1 execute unless score $enable_on_fire ts.dl.settings matches -1..2 run scoreboard players set $enable_on_fire ts.dl.settings 1 execute unless score $enable_glowing ts.dl.settings matches -1..2 run scoreboard players set $enable_glowing ts.dl.settings 0 execute unless score $fire_aspect ts.dl.settings matches -1..2 run scoreboard players set $fire_aspect ts.dl.settings 1 diff --git a/data/dynamiclights/function/internal/main.mcfunction b/data/dynamiclights/function/internal/main.mcfunction index f7dbe50..77f8a5c 100644 --- a/data/dynamiclights/function/internal/main.mcfunction +++ b/data/dynamiclights/function/internal/main.mcfunction @@ -10,7 +10,7 @@ tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove execute as @e[type=minecraft:tnt] at @s run function dynamiclights:internal/explosion_detection/tnt # Core -execute unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec +execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec # Clear old lights execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamiclights:internal/remove_light diff --git a/data/dynamiclights/function/settings/core.mcfunction b/data/dynamiclights/function/settings/core.mcfunction index f3c7726..9278e33 100644 --- a/data/dynamiclights/function/settings/core.mcfunction +++ b/data/dynamiclights/function/settings/core.mcfunction @@ -2,6 +2,13 @@ tellraw @s {"text":"\n=-=Dynamic Lights Settings=-=","bold":true,"color":"dark_green"} +execute if score $enable ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches -1 run tellraw @s [{"text":"[❌] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $enable ts.dl.settings matches 2 run tellraw @s [{"text":"[✔] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $enable ts.dl.settings matches -1..0 run tellraw @s {"text":"-- \u26a0 Dynamic Lights disabled \u26a0 --","color":"red"} + + tellraw @s {"text":"\nEnable light emitting from...","bold":true,"color":"white"} execute if score $enable_on_fire ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle this feature "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_on_fire"}},{"text":"Burning entities","color":"white"}] diff --git a/data/dynamiclights/function/settings/toggle_enable.mcfunction b/data/dynamiclights/function/settings/toggle_enable.mcfunction new file mode 100644 index 0000000..9c5bf1b --- /dev/null +++ b/data/dynamiclights/function/settings/toggle_enable.mcfunction @@ -0,0 +1,8 @@ +##by Tschipcraft + +execute if score $enable ts.dl.settings matches 1 run tellraw @s ["",{"text":"\n-> Disabled "},{"text":"Dynamic Lights globally","color":"yellow"}] +execute if score $enable ts.dl.settings matches 0 run tellraw @s ["",{"text":"\n-> Enabled "},{"text":"Dynamic Lights globally","color":"yellow"}] + +scoreboard players add $enable ts.dl.settings 1 +execute if score $enable ts.dl.settings matches 2 run scoreboard players set $enable ts.dl.settings 0 +function dynamiclights:settings diff --git a/data/dynamiclights/functions/install.mcfunction b/data/dynamiclights/functions/install.mcfunction index b8e6a77..07907d2 100644 --- a/data/dynamiclights/functions/install.mcfunction +++ b/data/dynamiclights/functions/install.mcfunction @@ -43,6 +43,7 @@ scoreboard objectives add ts.dl.mess.welc dummy scoreboard objectives add ts.dl.settings dummy # defaults +execute unless score $enable ts.dl.settings matches -1..2 run scoreboard players set $enable ts.dl.settings 1 execute unless score $enable_on_fire ts.dl.settings matches -1..2 run scoreboard players set $enable_on_fire ts.dl.settings 1 execute unless score $enable_glowing ts.dl.settings matches -1..2 run scoreboard players set $enable_glowing ts.dl.settings 0 execute unless score $fire_aspect ts.dl.settings matches -1..2 run scoreboard players set $fire_aspect ts.dl.settings 1 diff --git a/data/dynamiclights/functions/internal/main.mcfunction b/data/dynamiclights/functions/internal/main.mcfunction index 4bcf1c6..39556ea 100644 --- a/data/dynamiclights/functions/internal/main.mcfunction +++ b/data/dynamiclights/functions/internal/main.mcfunction @@ -10,7 +10,7 @@ tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove execute as @e[type=minecraft:tnt] at @s run function dynamiclights:internal/explosion_detection/tnt # Core -execute unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec +execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec # Clear old lights execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamiclights:internal/remove_light diff --git a/data/dynamiclights/functions/settings/core.mcfunction b/data/dynamiclights/functions/settings/core.mcfunction index f3c7726..9278e33 100644 --- a/data/dynamiclights/functions/settings/core.mcfunction +++ b/data/dynamiclights/functions/settings/core.mcfunction @@ -2,6 +2,13 @@ tellraw @s {"text":"\n=-=Dynamic Lights Settings=-=","bold":true,"color":"dark_green"} +execute if score $enable ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches -1 run tellraw @s [{"text":"[❌] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $enable ts.dl.settings matches 2 run tellraw @s [{"text":"[✔] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $enable ts.dl.settings matches -1..0 run tellraw @s {"text":"-- \u26a0 Dynamic Lights disabled \u26a0 --","color":"red"} + + tellraw @s {"text":"\nEnable light emitting from...","bold":true,"color":"white"} execute if score $enable_on_fire ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle this feature "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_on_fire"}},{"text":"Burning entities","color":"white"}] diff --git a/data/dynamiclights/functions/settings/toggle_enable.mcfunction b/data/dynamiclights/functions/settings/toggle_enable.mcfunction new file mode 100644 index 0000000..9c5bf1b --- /dev/null +++ b/data/dynamiclights/functions/settings/toggle_enable.mcfunction @@ -0,0 +1,8 @@ +##by Tschipcraft + +execute if score $enable ts.dl.settings matches 1 run tellraw @s ["",{"text":"\n-> Disabled "},{"text":"Dynamic Lights globally","color":"yellow"}] +execute if score $enable ts.dl.settings matches 0 run tellraw @s ["",{"text":"\n-> Enabled "},{"text":"Dynamic Lights globally","color":"yellow"}] + +scoreboard players add $enable ts.dl.settings 1 +execute if score $enable ts.dl.settings matches 2 run scoreboard players set $enable ts.dl.settings 0 +function dynamiclights:settings diff --git a/net/tschipcraft/dynamiclights/fabric/Config.class b/net/tschipcraft/dynamiclights/fabric/Config.class index ed2ccd4301d23ea20a2f35f91ba14f97d99015bd..7cba283ec4f2f5eac1223c40781257611d73c54b 100644 GIT binary patch literal 1937 zcmb7EYj4~{6g{)a?q-{zc|aS&yKM+bOY3A4%A+Bq-L{ajZ6QTL;>*fw&+ZPg$B{kT zDnEiB1AIW@13!Qtg*YBN1=U$8k)=Cl?!7bj+{gIufByUnz&4%<+%U>|HVa1jC`kQ* z^}=K0$2y4gaAY%Y;P+DUcI=@pejDH#{zT1DCzrAFH_bsYQ|b< zGf3!=FLZ1ue$dsWh;rc66NCo=r8|7v|aJWnh}~ei&-26T@1R@fXWedGMZ} z9jSmZPB^6c$m)=!7D}%?q*0OMRouG8R1!N<>3_^#`0NX7Z8FAs&eJCuWXaf&&ZY9Q z)YsY~sEIZOn@aB1XlTXMFpI>of{l}*V-TM-4EVt0a zmc*Mms^JrfcM9~W#JdIhT;ja~-H~{|KwnCHP@u0Qt`+F6#7coW5+4@mfy7#YzLr=o z(7wd=0(~p6d@wdv$LdgLniF@|n8f;dOY))YBzdvty4t8G?VO99r~%x z_oY(qvlVG4^0Q3w@P%i|I1SW89VuL4X48BYOK4#Z^ALE<-7MD}FZ_f>8eX4dcw>^` z(j>#>Nrt6K2A02M)!_OT*|qTYOXplS?{sWV#gA>O=-9A|j;*Wc*u;wN$|-TLo}y#h zD`z4Pad;|cIYt#72kI4Fje9;B$|tOx$5n8xU;hKQekG{kDP>+* zD)AkqEU||T?q;z0^6)Rt0_^{W?cZ_R$lsvYQhS zjzF7X!G1URoFuMt5LfsVSNY)9h&K38+LYV4jU9fwxQ9Jb|K6RM;>)dJW^Wn!e_?jD Ph1a-V#?FI0*-GdF19T6z-Cy0^;kG;EHq0*3 zhH^8lN2Ucc^0{`wwl+lTw;%4%I0A>pVK_97MQWxhq7sgEDID*jagvUNoT)?ObRAl< zGau{oC6k?^)c7HeV1A85<0t*obe_32#6xDv(Q35r^b0ag5*>A-Jz9z;j%b8BAj{i; z4|9Lf57Gl{J!7GTMTtuiOA^Zxs}k2FZb(%3cO>7FcwpDoWbG{X1>9B-Vky>+b7vAT hkmTBCxRN<`pJxvx6j4S6RknO=U3+8R6Nc$<{{luHOcekC diff --git a/net/tschipcraft/dynamiclights/fabric/Init.class b/net/tschipcraft/dynamiclights/fabric/Init.class index 52c8d0fe4520c75ae2be0be2d4ed3ad82eb7db33..4de046586707a8a4bf14fadfde6e429c30a76b88 100644 GIT binary patch delta 19 acmew?@>yiVLpHYZ{Gyx`h0V{|dYA!Nvr delta 19 acmew?@>yiVLpHYJ)S|M~qRr3QdYA!PX9#it diff --git a/net/tschipcraft/dynamiclights/fabric/sendConfig.class b/net/tschipcraft/dynamiclights/fabric/sendConfig.class index aae5669c315da0aabb7622cb11a86863ac1767b8..eba211d4c5b944d3e01f6a44e09c6937ca7c34a0 100644 GIT binary patch delta 1383 zcmYLI+fQ6&5T7~w?Vhu{hrPjGU|}yzx?RfxYv@_nT_BWO z(`XFoLknXX!a~SA55xq&e_^*_WNe$oB7ReF6Xb- zlN}}3Zl2!+fL8bgAu+dDLlJbWbY4KGEv=|BuiH?R>(K?4mRb}g+fN_&&Qe-*ou%YzK7^ndxVB08(pzP!YAjINqmZ?luG3pGvrzJ>c;)_yK)~s zPci!pCTY<=jVX#cg33YDsh7GP_lQ2di2EIPD>~i)!Von&+h|jc(u^}qCsZ3XICIfK zgj+4mWrhlw-n0su36n)=rj(k{*$vYl&UVaGt$Ij|AoSCnYKu{^Lk$YXA0sRYDC1_} zVTzV?h)IN2-jNXPcU2f1rV%uQ)PvEh6#ZOJ{IwQ6IaNK))hWYG>)~mvC6Xt|oe%unJ$2=i1ug}m_{05iT z5ONgtwlkMF-Skx9NviaY-tjtuzc{p9Dx)RyX)T{AWJb9uZs)=QUEp#t#vB>ZtT`El|AHi7%oPm$&Z&p5q&va#ly#8|Q z_GTH@Xm?qc@&&9r;B(lZxv~cQk}j6DM=rou4mb}N5j-!YMpKEwl-8ekqLAb5m*H!U zufofe@L%2a9e>0LK>h((>o>r)!h!_f^Jz1TGW@`@YC3=$JgnKl3qJPZV9RB`Iau1c z))fdyU90fcD#T8M>N{0`4$7AyZdht`%c5y<``*z7-+TJ0r?bG1eAaU12SRbD*Xz{N zV?FFzn+>^fMw6nDmA1l=)B?lO4#-PAP>>#m(c8?VolpwzGsrdmTagu=WB`IDNtopv zf^ETub@*ftAFJzduD)>{HlJPwv3G?luyRFy_@GE80Mfs#@)$0S$#6!7D}XY;8jT6C zGr%~X6C5%-1CHRRY2fN5j+0j!D JKeH}@^*^0VMREWD delta 1315 zcmYLJT}&KR6#mZc?9T3Vb{7_Amt9!4Qb5x-t_TGrr6K;r7;Qru<6jfU6$V(t4s>^b zwpLnAjcH7y<(S4)X{mqp9}uP5TD8U}A546=!6zRz)##f)XJ(d|&Cb1N?svZXo$sDI zXZru@iGBai<*xwr;9ElB^il`6lD4}03dQ4=U3_xVGN){FtW@E@X+QPx4W*ao0|x(* z$ncV?a$P9R)0#q^d@a<%!-`3_Ff|$+PpT5-ITvrO;j+9K+@g+8PR*6QCLY$>X+O_s$LK-+Q=8xR5FuG(k`u7ZVs+XYk~Ry4B&B2=YmepcTlKGr2A_P0$E>T9B0^K5HU&Qpi&Q%w=NJxwc#EDy!P zCcN1ZM;!$xb?iS*%}-58Rewk8W}#7%+*>$b%Cyq z7o|gHJ5LdeT6vXX$u_H&T`f7KS#j$npZ#S*pBR+kpBr+n?F(MBY&5ibj=drm!QitE zV{}F?!V!9vk2c!M>x6bb-q;>gagGh65Lv-k-J?0$qxu^zl8XzOak~)o?-8$imN=C&cp;5oRt*;2GVN_=~Tdj2H}1kw&A8G z{w$;zY2Aq}XYx##r0>}kTAuX(~jFSjLkukkv9dGWH z$HjGgw0-9~)*ikHW#6iBgph=RMFG0IrV#j7Lh<7>73Wo40;#g-iBAa@m^NjoNRlJC zswB*Ka<&SA?1R_vxs2}273R}_fy<)Dl^6{O0G`YMzLA+G5LF~=Lm6C?IDpW9*n>Y) diff --git a/net/tschipcraft/dynamiclights/forge/Config.class b/net/tschipcraft/dynamiclights/forge/Config.class index 070d4c209f6b68a972178e3f8ea8c65ccdafc5fb..de12652e40c6edbec6d3e7cd460d74023b654ee0 100644 GIT binary patch literal 1957 zcmb7EYi}Dx6g^`ncH9ij1KJSYZ9_;x={89zkEUr_x1|9mg|rG1U##`+*dAohM!Vxy z`4RjW-~$pL_yPPV#F^PmLETtNw9=h3_uiR%?ql}vfByUnz+F5SSTo87HjDcDC`!Yw z4dP=H4s|rpy}r$YZj$y?&`eBM_v#P=t7;Ssb!?nD9%VKd=uQxMd$3pNPu!~l(>cEJ zbNC_@2+kgCsgopwI%)zF4hgKEIq*_584i`PbuB%N^3&Xl!`nz0tz zbQ3zbg^o34!p?wP)?4SSESapIgTJo=&rJHU5V)8JZYQSQ)hP*_D9HFFsS3!#qt_2J zD{#5kDiifX79ehGtA@;Ip)jzdwtt-2woNs=7rW$K6`1907{}V`#IO`a{Q2UP3*HX1 zBNZ{m35Qf4SsjzqT;b(H8a42|@>@5VN@Dve{g2tpkZob9O~zO+c={xREEyTnxl~-1 zhT8n!t+u6&w%Y>LmDNLuPjUSMCh!@1W&4^5UOz``+E#zr{`mBu^-y91iw)GV zDe<;L6?`u7UXH$yct1y9Nqmr_I}#t}=&r;^Il3otEl2kymU7gT_&7(8Bvx|tjl^n> zb|uzw^qs)s!N^!WREIj#oVWYNBsO#%aU7VRo)df`3us^lvk=(hZknsZb3b98 zhBwC<-Wq4PG|q5&oMB;{fz2pb)wsSxb`8Ay%Gv2=y^gIa`LSsw9otvZv5_SmTUydx zIVJAZQ*<1H(pio}Nyot`>6TBq?~_w>9Hr7(4pm9V@p?^H;hyh@a-Wq8xC*Y5Yk%Oz zuLKo5rF4a*65mtG0tdLs-4xbe9sb2zfZgA4>v!Dt@=Gtj_HxV1Z7+AceBk9nFCTmP z#LI8JY&inL6WCx_u-`R4E{Urg#3eq=Wj?AWwe*yBan@9iv literal 1908 zcmb7FTW{P%6#gcc-E1>77iij)YauO7Xk)g4LP>gK=?yk16ci+0R$hB{caS}f?Aca% z<`)4ENIdWZ_)&;&#!f+XR!UyZ`FzgIobTM^zyJC3F95gkoxp}sHn2rB(g#r<4r~w~ znlRN-qK6|}1cNLes-TmZfgUy?1lH9!NOf$SJ02G{NOV7lyg%5j>_^9^1?Ee<`E&R@ z6bMcpY^|SVNfQl$8HWVgCl0*U$TiugCSdrKkn2X3vUQYH?Dke_Q$8sx?f4Oaj}IaZb+;;G=)zj z-YU^eiMLDixx_mq`a<=yE4irtbg7~!lF>T zeCGRXoJZ=Rb{FRNRAG0Od!oQ4W;erqSV0R5ScJgW{FTGY4amzKRW@D>rHa4whWBY2h_l}8s=@=UuUc1ZI*K8bu zn(gv2?_D{@#<8j0vw$WpIsaAon&Y+`>(4V~79EY3%X*Md~KW&)r*vTmJbgExbm3mij6EQ%vSt J>KR69{tFEOl$`(o diff --git a/net/tschipcraft/dynamiclights/forge/Init$1.class b/net/tschipcraft/dynamiclights/forge/Init$1.class index d89c3ed8445cab8c9ffc404988f53b50e85d0cc7..7e663dde996012764c50f3e4abbb0cf22baba181 100644 GIT binary patch delta 43 zcmX@heU^K}7ACgx{Gyx`h0VK|yqFkuCbP1p^XfBjGZ-+4G8i(*Fc?p+WDNlTA^-}) delta 43 zcmX@heU^K}7ACgh)S|M~qRqRQyqFlZC$qAq^Xf5hGw3sjG8iz(Fc?j)WDNlTD%cAQ diff --git a/net/tschipcraft/dynamiclights/forge/Init.class b/net/tschipcraft/dynamiclights/forge/Init.class index 588987d20bd0f88c6153390536ad32c4d0f893c6..bc906937d43c05bf9bb1beb074c900e52bf6b770 100644 GIT binary patch delta 97 zcmbQNJXv`|0l%Um0}F!^12=;zgE)f*gF1sIgD!&(gDryvg9C#ZgCm3GG&Wbl}*E#SxKG`UJZhtYZRa)ESCS)eKz1|9~v$>M@F0OZXNwEzGB diff --git a/net/tschipcraft/dynamiclights/forge/sendConfig.class b/net/tschipcraft/dynamiclights/forge/sendConfig.class index 7b1be9a8b3f359b5d566377223bf685fb686101d..a97ad66670de72a4c5ce0b7ed986fae6541e3221 100644 GIT binary patch delta 1424 zcmYLJYj0F#5Ps(L-96jg?Y4XEw%hKuwSW{t!PM=AV89rN4J8_4iYB-&bX!*1({^_$ z*Fs2*_o!uJjHne*sTC=`XhBp2FQ`boeB_({0FCjBCX&`U=d2+odEc2iGtWHpoXJ^i znP@A!v3U6kfDO1wSTjD+$kpVYU4MZ*&Ww@X)t@1(+d4kc#4EH0YUW`_oa^- zvYOAARC0}4Zr#5+6z^2E{JWOoTh^W6pGxBb5pP)MLdzY5zW%}eS)L>@ zbk%seZL}REvkp6=JngzmJx1s#I(2-?t#hb!lpg03rAO%r_PZ-xyX>Ofyw=@L85uOj zx7{&ozCOYb$36GTYzYa*Da$cWA+h(4=DF-pA={JjV!%c*2<9$C`L?Ih)O?74^CVS{ zu!m0vg1pAttqO#`q7%19kW}+aju8AsnM{$4OuzLp57@v5*@9`;*qL|5;H>ud>fSvivnd zxHwEMoi$SVjFHb4vLm9@>o(R&dpo1NT{ZS*y7FXTjN9ap$IyoRpwgW;Q<*X2LZ43Y^Y4ZPKK3DHT^ zTaiXH^0pl*51clQz&qw?wkyH+axO<>)bH{0ShQZ3_SA&V`E${7I%a4I3~F~{NLzW%ZTC_TC=bZmL-}%lt|KIFi z>GfY_7Z$89i_2Cz2QS2^ft6%8(;M%1*P$6HLBdDVSwku z-JDT7Xo&v^ck)fO%aUP363TYMvzES_>OQ)cH)u)k{WjGD1hW*K%UXtZayFFYl9qOv zMLom^LNUIjjVTWkrul|8V2P9CJLGg1A<+_7s1zGxhwF`eqgJj|iidm{w#i2OLpAL)?|+nZC*ysod3@!;mslW#o-Rxka^nS~l-nb>!zig(v~L|{RF9QZ+2x8+oEnNK7-`~q}N$%z0RiNy z*Ey}bH8YqZ*txh>57JBpmj&RnlNa$K-LRo0rsGz9iwT>>U84H+Sj kJh+H&WjFs!H8%ZsxFoeXa8>*s@u{NGb6*FR#dg5;AL*qYumAu6 diff --git a/src/main/java/net/tschipcraft/dynamiclights/fabric/Config.java b/src/main/java/net/tschipcraft/dynamiclights/fabric/Config.java index ffd66d9..a94aff2 100644 --- a/src/main/java/net/tschipcraft/dynamiclights/fabric/Config.java +++ b/src/main/java/net/tschipcraft/dynamiclights/fabric/Config.java @@ -22,6 +22,9 @@ public enum bool { @Comment(centered = true) public static Comment info2; + @Entry + public static bool enable = bool.WORLD; + @Comment public static Comment light; diff --git a/src/main/java/net/tschipcraft/dynamiclights/fabric/sendConfig.java b/src/main/java/net/tschipcraft/dynamiclights/fabric/sendConfig.java index f62e315..8444825 100644 --- a/src/main/java/net/tschipcraft/dynamiclights/fabric/sendConfig.java +++ b/src/main/java/net/tschipcraft/dynamiclights/fabric/sendConfig.java @@ -8,6 +8,15 @@ public class sendConfig { public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard objectives add ts.dl.settings dummy", server); + if (Config.enable == Config.bool.YES) { + sendCommand("scoreboard players set $enable ts.dl.settings 2", server); + } else if (Config.enable == Config.bool.NO) { + sendCommand("scoreboard players set $enable ts.dl.settings -1", server); + } else { + sendCommand("execute if score $enable ts.dl.settings matches -1 run scoreboard players set $enable ts.dl.settings 0", server); + sendCommand("execute if score $enable ts.dl.settings matches 2 run scoreboard players set $enable ts.dl.settings 1", server); + } + if (Config.enable_on_fire == Config.bool.YES) { sendCommand("scoreboard players set $enable_on_fire ts.dl.settings 2", server); } else if (Config.enable_on_fire == Config.bool.NO) { diff --git a/src/main/java/net/tschipcraft/dynamiclights/forge/Config.java b/src/main/java/net/tschipcraft/dynamiclights/forge/Config.java index ef5cfaf..bd524c7 100644 --- a/src/main/java/net/tschipcraft/dynamiclights/forge/Config.java +++ b/src/main/java/net/tschipcraft/dynamiclights/forge/Config.java @@ -22,6 +22,9 @@ public enum bool { @Comment(centered = true) public static Comment info2; + @Entry + public static bool enable = bool.WORLD; + @Comment public static Comment light; diff --git a/src/main/java/net/tschipcraft/dynamiclights/forge/sendConfig.java b/src/main/java/net/tschipcraft/dynamiclights/forge/sendConfig.java index 4f2efac..4b337e3 100644 --- a/src/main/java/net/tschipcraft/dynamiclights/forge/sendConfig.java +++ b/src/main/java/net/tschipcraft/dynamiclights/forge/sendConfig.java @@ -8,6 +8,15 @@ public class sendConfig { public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard objectives add ts.dl.settings dummy", server); + if (Config.enable == Config.bool.YES) { + sendCommand("scoreboard players set $enable ts.dl.settings 2", server); + } else if (Config.enable == Config.bool.NO) { + sendCommand("scoreboard players set $enable ts.dl.settings -1", server); + } else { + sendCommand("execute if score $enable ts.dl.settings matches -1 run scoreboard players set $enable ts.dl.settings 0", server); + sendCommand("execute if score $enable ts.dl.settings matches 2 run scoreboard players set $enable ts.dl.settings 1", server); + } + if (Config.enable_on_fire == Config.bool.YES) { sendCommand("scoreboard players set $enable_on_fire ts.dl.settings 2", server); } else if (Config.enable_on_fire == Config.bool.NO) { From 9aab63fc4b477d5813b8a585776137c26f756184 Mon Sep 17 00:00:00 2001 From: Tschipcraft <78470530+Tschipcraft@users.noreply.github.com> Date: Mon, 9 Sep 2024 23:37:07 +0200 Subject: [PATCH 6/7] Add per-player toggle Added per-player toggle for Dynamic Lights (closes #37, #26, #47) --- CHANGES.md | 2 +- .../advancement/toggle_enable.json | 23 +++++++++++++++++++ .../advancements/toggle_enable.json | 23 +++++++++++++++++++ .../dynamiclights/function/install.mcfunction | 5 +++- .../function/internal/main.mcfunction | 2 +- data/dynamiclights/function/reset.mcfunction | 4 +++- .../function/settings/core.mcfunction | 8 ++++--- ...nction => toggle_enable_global.mcfunction} | 0 .../settings/toggle_enable_player.mcfunction | 12 ++++++++++ .../function/uninstall.mcfunction | 1 + .../functions/install.mcfunction | 6 ++++- .../functions/internal/main.mcfunction | 2 +- data/dynamiclights/functions/reset.mcfunction | 4 +++- .../functions/settings/core.mcfunction | 8 ++++--- ...nction => toggle_enable_global.mcfunction} | 0 .../settings/toggle_enable_player.mcfunction | 12 ++++++++++ .../functions/uninstall.mcfunction | 1 + 17 files changed, 100 insertions(+), 13 deletions(-) create mode 100644 data/dynamiclights/advancement/toggle_enable.json create mode 100644 data/dynamiclights/advancements/toggle_enable.json rename data/dynamiclights/function/settings/{toggle_enable.mcfunction => toggle_enable_global.mcfunction} (100%) create mode 100644 data/dynamiclights/function/settings/toggle_enable_player.mcfunction rename data/dynamiclights/functions/settings/{toggle_enable.mcfunction => toggle_enable_global.mcfunction} (100%) create mode 100644 data/dynamiclights/functions/settings/toggle_enable_player.mcfunction diff --git a/CHANGES.md b/CHANGES.md index 587eb02..6ba202b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,5 @@ - Added Curios API and Curios API Continuation support (closes [#52](https://github.com/Tschipcraft/dynamiclights/issues/52)) -- Added global toggle for Dynamic Lights (closes [#56](https://github.com/Tschipcraft/dynamiclights/issues/56)) +- Added global and per-player toggle for Dynamic Lights (closes [#56](https://github.com/Tschipcraft/dynamiclights/issues/56), closes [#37](https://github.com/Tschipcraft/dynamiclights/issues/37), closes [#26](https://github.com/Tschipcraft/dynamiclights/issues/26), closes [#47](https://github.com/Tschipcraft/dynamiclights/issues/47)) - Added mod support for Lucky's Wardrobe - Fixed ominous item spawners not being parsed for light emitting items - Fixed Dynamic Lights breaking after some time on paper servers (closes [#45](https://github.com/Tschipcraft/dynamiclights/issues/45), closes [#21](https://github.com/Tschipcraft/dynamiclights/issues/21)) diff --git a/data/dynamiclights/advancement/toggle_enable.json b/data/dynamiclights/advancement/toggle_enable.json new file mode 100644 index 0000000..b7e6f59 --- /dev/null +++ b/data/dynamiclights/advancement/toggle_enable.json @@ -0,0 +1,23 @@ +{ + "criteria": { + "trigger_menu": { + "trigger": "minecraft:tick", + "conditions": { + "player": [ + { + "condition": "minecraft:entity_scores", + "entity": "this", + "scores": { + "ts.dl.toggle": { + "min": 1 + } + } + } + ] + } + } + }, + "rewards": { + "function": "dynamiclights:settings/toggle_enable_player" + } +} diff --git a/data/dynamiclights/advancements/toggle_enable.json b/data/dynamiclights/advancements/toggle_enable.json new file mode 100644 index 0000000..b7e6f59 --- /dev/null +++ b/data/dynamiclights/advancements/toggle_enable.json @@ -0,0 +1,23 @@ +{ + "criteria": { + "trigger_menu": { + "trigger": "minecraft:tick", + "conditions": { + "player": [ + { + "condition": "minecraft:entity_scores", + "entity": "this", + "scores": { + "ts.dl.toggle": { + "min": 1 + } + } + } + ] + } + } + }, + "rewards": { + "function": "dynamiclights:settings/toggle_enable_player" + } +} diff --git a/data/dynamiclights/function/install.mcfunction b/data/dynamiclights/function/install.mcfunction index 1198a08..b4b306f 100644 --- a/data/dynamiclights/function/install.mcfunction +++ b/data/dynamiclights/function/install.mcfunction @@ -60,7 +60,9 @@ execute unless score $rain_sensitive ts.dl.settings matches -1..2 run scoreboard execute unless score $unlimited ts.dl.settings matches -1..2 run scoreboard players set $unlimited ts.dl.settings 0 scoreboard objectives add tschipcraft.menu trigger +scoreboard objectives add ts.dl.toggle trigger scoreboard players enable @a tschipcraft.menu +scoreboard players enable @a ts.dl.toggle scoreboard objectives add tvc_ignore dummy @@ -68,8 +70,9 @@ scoreboard objectives add tvc_ignore dummy # 18 for v1.8 scoreboard players set dynamiclights load.status 18 -# Reset advancement +# Reset advancements advancement revoke @a only tschipcraft:menu +advancement revoke @a only dynamiclights:toggle_enable ## Schedule main function schedule function dynamiclights:internal/main 5t diff --git a/data/dynamiclights/function/internal/main.mcfunction b/data/dynamiclights/function/internal/main.mcfunction index 77f8a5c..06b3684 100644 --- a/data/dynamiclights/function/internal/main.mcfunction +++ b/data/dynamiclights/function/internal/main.mcfunction @@ -10,7 +10,7 @@ tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove execute as @e[type=minecraft:tnt] at @s run function dynamiclights:internal/explosion_detection/tnt # Core -execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec +execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui,tag=!ts.dl.ignore] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec # Clear old lights execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamiclights:internal/remove_light diff --git a/data/dynamiclights/function/reset.mcfunction b/data/dynamiclights/function/reset.mcfunction index c282782..6716651 100644 --- a/data/dynamiclights/function/reset.mcfunction +++ b/data/dynamiclights/function/reset.mcfunction @@ -8,9 +8,11 @@ kill @e[type=minecraft:armor_stand,tag=ts.dl.i.parser] # Reset explosion alarm function dynamiclights:internal/explosion_detection/reset -# Reset advancement +# Reset advancements advancement revoke @a only tschipcraft:menu scoreboard players enable @a tschipcraft.menu +advancement revoke @a only dynamiclights:toggle_enable +scoreboard players enable @a ts.dl.toggle # Reset parsed data scoreboard objectives remove ts.dl.i.type diff --git a/data/dynamiclights/function/settings/core.mcfunction b/data/dynamiclights/function/settings/core.mcfunction index 9278e33..273eb8d 100644 --- a/data/dynamiclights/function/settings/core.mcfunction +++ b/data/dynamiclights/function/settings/core.mcfunction @@ -2,12 +2,14 @@ tellraw @s {"text":"\n=-=Dynamic Lights Settings=-=","bold":true,"color":"dark_green"} -execute if score $enable ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] -execute if score $enable ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable_global"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable_global"}},{"text":"Enable Dynamic Lights","color":"white"}] execute if score $enable ts.dl.settings matches -1 run tellraw @s [{"text":"[❌] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] execute if score $enable ts.dl.settings matches 2 run tellraw @s [{"text":"[✔] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $enable ts.dl.settings matches -1..0 run tellraw @s {"text":"-- \u26a0 Dynamic Lights disabled \u26a0 --","color":"red"} +execute if score $enable ts.dl.settings matches -1..0 run tellraw @s {"text":"-- \u26a0 Dynamic Lights disabled \u26a0 --","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable_global"}} +execute as @s[tag=!ts.dl.ignore] run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":" for "},{"selector": "@s"},{"text": "."}]},"clickEvent":{"action":"run_command","value":"/trigger ts.dl.toggle"}},{"text":"Enable Dynamic Lights for yourself","color":"white"}] +execute as @s[tag=ts.dl.ignore] run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":" for "},{"selector": "@s"},{"text": "."}]},"clickEvent":{"action":"run_command","value":"/trigger ts.dl.toggle"}},{"text":"Enable Dynamic Lights for yourself","color":"white"}] tellraw @s {"text":"\nEnable light emitting from...","bold":true,"color":"white"} diff --git a/data/dynamiclights/function/settings/toggle_enable.mcfunction b/data/dynamiclights/function/settings/toggle_enable_global.mcfunction similarity index 100% rename from data/dynamiclights/function/settings/toggle_enable.mcfunction rename to data/dynamiclights/function/settings/toggle_enable_global.mcfunction diff --git a/data/dynamiclights/function/settings/toggle_enable_player.mcfunction b/data/dynamiclights/function/settings/toggle_enable_player.mcfunction new file mode 100644 index 0000000..47881d0 --- /dev/null +++ b/data/dynamiclights/function/settings/toggle_enable_player.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft + +execute as @s[tag=!ts.dl.ignore] run tellraw @s ["",{"text":"\n-> Disabled "},{"text":"Dynamic Lights for yourself","color":"yellow"}] +execute as @s[tag=ts.dl.ignore] run tellraw @s ["",{"text":"\n-> Enabled "},{"text":"Dynamic Lights for yourself","color":"yellow"}] + +execute store success score #temp ts.dl.toggle run tag @s add ts.dl.ignore + +execute if score #temp ts.dl.toggle matches 0 run tag @s remove ts.dl.ignore +scoreboard players reset @s ts.dl.toggle +scoreboard players enable @a ts.dl.toggle +advancement revoke @a only dynamiclights:toggle_enable +execute at @s run function dynamiclights:settings diff --git a/data/dynamiclights/function/uninstall.mcfunction b/data/dynamiclights/function/uninstall.mcfunction index 05ab816..30b5dfb 100644 --- a/data/dynamiclights/function/uninstall.mcfunction +++ b/data/dynamiclights/function/uninstall.mcfunction @@ -25,6 +25,7 @@ scoreboard objectives remove ts.dl.temp scoreboard objectives remove ts.dl.mess.welc scoreboard objectives remove ts.dl.settings +scoreboard objectives remove ts.dl.toggle scoreboard objectives remove tschipcraft.menu scoreboard objectives remove ts.dl.version diff --git a/data/dynamiclights/functions/install.mcfunction b/data/dynamiclights/functions/install.mcfunction index 07907d2..abd79bf 100644 --- a/data/dynamiclights/functions/install.mcfunction +++ b/data/dynamiclights/functions/install.mcfunction @@ -61,6 +61,9 @@ execute unless score $rain_sensitive ts.dl.settings matches -1..2 run scoreboard execute unless score $unlimited ts.dl.settings matches -1..2 run scoreboard players set $unlimited ts.dl.settings 0 scoreboard objectives add tschipcraft.menu trigger +scoreboard objectives add ts.dl.toggle trigger +scoreboard players enable @a tschipcraft.menu +scoreboard players enable @a ts.dl.toggle scoreboard objectives add tvc_ignore dummy @@ -68,8 +71,9 @@ scoreboard objectives add tvc_ignore dummy # 18 for v1.8 scoreboard players set dynamiclights load.status 18 -# Reset advancement +# Reset advancements advancement revoke @a only dynamiclights:interacted_with_item_frame +advancement revoke @a only dynamiclights:toggle_enable ## Schedule functions schedule function dynamiclights:internal/main 5t diff --git a/data/dynamiclights/functions/internal/main.mcfunction b/data/dynamiclights/functions/internal/main.mcfunction index 39556ea..42e1a20 100644 --- a/data/dynamiclights/functions/internal/main.mcfunction +++ b/data/dynamiclights/functions/internal/main.mcfunction @@ -10,7 +10,7 @@ tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove execute as @e[type=minecraft:tnt] at @s run function dynamiclights:internal/explosion_detection/tnt # Core -execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec +execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui,tag=!ts.dl.ignore] unless entity @s[type=minecraft:player,gamemode=spectator] at @s run function dynamiclights:internal/main_exec # Clear old lights execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamiclights:internal/remove_light diff --git a/data/dynamiclights/functions/reset.mcfunction b/data/dynamiclights/functions/reset.mcfunction index 7ba5f98..d3e13fe 100644 --- a/data/dynamiclights/functions/reset.mcfunction +++ b/data/dynamiclights/functions/reset.mcfunction @@ -8,8 +8,10 @@ kill @e[type=minecraft:armor_stand,tag=ts.dl.i.parser] # Reset explosion alarm function dynamiclights:internal/explosion_detection/reset -# Reset advancement +# Reset advancements advancement revoke @a only dynamiclights:interacted_with_item_frame +advancement revoke @a only dynamiclights:toggle_enable +scoreboard players enable @a ts.dl.toggle # Reset parsed data scoreboard objectives remove ts.dl.i.type diff --git a/data/dynamiclights/functions/settings/core.mcfunction b/data/dynamiclights/functions/settings/core.mcfunction index 9278e33..273eb8d 100644 --- a/data/dynamiclights/functions/settings/core.mcfunction +++ b/data/dynamiclights/functions/settings/core.mcfunction @@ -2,12 +2,14 @@ tellraw @s {"text":"\n=-=Dynamic Lights Settings=-=","bold":true,"color":"dark_green"} -execute if score $enable ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] -execute if score $enable ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches 1 run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable_global"}},{"text":"Enable Dynamic Lights","color":"white"}] +execute if score $enable ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable_global"}},{"text":"Enable Dynamic Lights","color":"white"}] execute if score $enable ts.dl.settings matches -1 run tellraw @s [{"text":"[❌] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] execute if score $enable ts.dl.settings matches 2 run tellraw @s [{"text":"[✔] Enable Dynamic Lights","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $enable ts.dl.settings matches -1..0 run tellraw @s {"text":"-- \u26a0 Dynamic Lights disabled \u26a0 --","color":"red"} +execute if score $enable ts.dl.settings matches -1..0 run tellraw @s {"text":"-- \u26a0 Dynamic Lights disabled \u26a0 --","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enable_global"}} +execute as @s[tag=!ts.dl.ignore] run tellraw @s [{"text":"[✔] ","bold":true,"color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"off","color":"red"},{"text":" for "},{"selector": "@s"},{"text": "."}]},"clickEvent":{"action":"run_command","value":"/trigger ts.dl.toggle"}},{"text":"Enable Dynamic Lights for yourself","color":"white"}] +execute as @s[tag=ts.dl.ignore] run tellraw @s [{"text":"[❌] ","bold":true,"color": "red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle Dynamic Lights "},{"text":"on","color":"green"},{"text":" for "},{"selector": "@s"},{"text": "."}]},"clickEvent":{"action":"run_command","value":"/trigger ts.dl.toggle"}},{"text":"Enable Dynamic Lights for yourself","color":"white"}] tellraw @s {"text":"\nEnable light emitting from...","bold":true,"color":"white"} diff --git a/data/dynamiclights/functions/settings/toggle_enable.mcfunction b/data/dynamiclights/functions/settings/toggle_enable_global.mcfunction similarity index 100% rename from data/dynamiclights/functions/settings/toggle_enable.mcfunction rename to data/dynamiclights/functions/settings/toggle_enable_global.mcfunction diff --git a/data/dynamiclights/functions/settings/toggle_enable_player.mcfunction b/data/dynamiclights/functions/settings/toggle_enable_player.mcfunction new file mode 100644 index 0000000..47881d0 --- /dev/null +++ b/data/dynamiclights/functions/settings/toggle_enable_player.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft + +execute as @s[tag=!ts.dl.ignore] run tellraw @s ["",{"text":"\n-> Disabled "},{"text":"Dynamic Lights for yourself","color":"yellow"}] +execute as @s[tag=ts.dl.ignore] run tellraw @s ["",{"text":"\n-> Enabled "},{"text":"Dynamic Lights for yourself","color":"yellow"}] + +execute store success score #temp ts.dl.toggle run tag @s add ts.dl.ignore + +execute if score #temp ts.dl.toggle matches 0 run tag @s remove ts.dl.ignore +scoreboard players reset @s ts.dl.toggle +scoreboard players enable @a ts.dl.toggle +advancement revoke @a only dynamiclights:toggle_enable +execute at @s run function dynamiclights:settings diff --git a/data/dynamiclights/functions/uninstall.mcfunction b/data/dynamiclights/functions/uninstall.mcfunction index c4a7616..32da890 100644 --- a/data/dynamiclights/functions/uninstall.mcfunction +++ b/data/dynamiclights/functions/uninstall.mcfunction @@ -25,6 +25,7 @@ scoreboard objectives remove ts.dl.temp scoreboard objectives remove ts.dl.mess.welc scoreboard objectives remove ts.dl.settings +scoreboard objectives remove ts.dl.toggle scoreboard objectives remove tschipcraft.menu scoreboard objectives remove ts.dl.version From 3bd2b7c1ec4163d597f4bba4dea9662ec6b1f1c1 Mon Sep 17 00:00:00 2001 From: Tschipcraft <78470530+Tschipcraft@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:09:01 +0100 Subject: [PATCH 7/7] Support for 1.21.3 - Added support for Minecraft 1.21.3 - Added loop entries for scoreboard enables - Updated GitHub workflow --- .github/workflows/cd.yml | 8 ++++---- .github/workflows/test_workflow.yml | 4 ++-- .spyglassrc.json | 9 +++++++++ CHANGES.md | 5 +++-- data/dynamiclights/function/install.mcfunction | 3 ++- data/dynamiclights/function/internal/loop.mcfunction | 7 +++++++ data/dynamiclights/function/internal/main.mcfunction | 2 +- .../function/internal/version_checker/start.mcfunction | 3 ++- data/dynamiclights/functions/install.mcfunction | 2 +- data/dynamiclights/functions/internal/loop.mcfunction | 8 ++++++-- data/dynamiclights/functions/internal/main.mcfunction | 2 +- .../functions/internal/version_checker/start.mcfunction | 1 + pack.mcmeta | 2 +- 13 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 .spyglassrc.json create mode 100644 data/dynamiclights/function/internal/loop.mcfunction diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 62c4508..94732cb 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -96,7 +96,7 @@ jobs: name: "[DP] Release v${{ github.event.inputs.tag }}" version: ${{ github.event.inputs.tag }} - changelog-file: CHANGES.* + changelog-file: CHANGES.md loaders: | datapack @@ -115,7 +115,7 @@ jobs: name: "[Mod] Release v${{ github.event.inputs.tag }}" version: ${{ github.event.inputs.tag }}+mod - changelog-file: CHANGES.* + changelog-file: CHANGES.md dependencies: | fabric-api(optional){modrinth:P7dR8mSH} @@ -141,7 +141,7 @@ jobs: name: "Release v${{ github.event.inputs.tag }}" version: ${{ github.event.inputs.tag }} - changelog-file: CHANGES.* + changelog-file: CHANGES.md loaders: | datapack @@ -160,7 +160,7 @@ jobs: name: "Release v${{ github.event.inputs.tag }}" version: ${{ github.event.inputs.tag }}+mod - changelog-file: CHANGES.* + changelog-file: CHANGES.md dependencies: | catalogue(optional){curseforge:459701} diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index c6eeb3c..1948f79 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -9,11 +9,11 @@ on: mc_version: description: 'Minecraft version(s) the data pack runs in (human readable)' required: true - default: '1.17x-1.20x' + default: '1.17x-1.21x' mc_version_range: description: 'Minecraft version(s) the data pack runs in (encoded in version range spec)' required: true - default: '>=1.17 <=1.20.4' + default: '>=1.17 <=1.21' jobs: deploy: diff --git a/.spyglassrc.json b/.spyglassrc.json new file mode 100644 index 0000000..9f58bd6 --- /dev/null +++ b/.spyglassrc.json @@ -0,0 +1,9 @@ +{ + "env": { + "gameVersion": "1.21" + }, + "lint": { + "idOmitDefaultNamespace": ["warning", false], + "nbtTypeCheck": ["warning", "strictly"] + } +} diff --git a/CHANGES.md b/CHANGES.md index 6ba202b..40b75bf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ -- Added Curios API and Curios API Continuation support (closes [#52](https://github.com/Tschipcraft/dynamiclights/issues/52)) -- Added global and per-player toggle for Dynamic Lights (closes [#56](https://github.com/Tschipcraft/dynamiclights/issues/56), closes [#37](https://github.com/Tschipcraft/dynamiclights/issues/37), closes [#26](https://github.com/Tschipcraft/dynamiclights/issues/26), closes [#47](https://github.com/Tschipcraft/dynamiclights/issues/47)) +- **Added support for Minecraft 1.21.3** 💰 +- **Added Curios API and Curios API Continuation support** (closes [#52](https://github.com/Tschipcraft/dynamiclights/issues/52)) +- **Added global and per-player toggle for Dynamic Lights** (closes [#56](https://github.com/Tschipcraft/dynamiclights/issues/56), closes [#37](https://github.com/Tschipcraft/dynamiclights/issues/37), closes [#26](https://github.com/Tschipcraft/dynamiclights/issues/26), closes [#47](https://github.com/Tschipcraft/dynamiclights/issues/47)) - Added mod support for Lucky's Wardrobe - Fixed ominous item spawners not being parsed for light emitting items - Fixed Dynamic Lights breaking after some time on paper servers (closes [#45](https://github.com/Tschipcraft/dynamiclights/issues/45), closes [#21](https://github.com/Tschipcraft/dynamiclights/issues/21)) diff --git a/data/dynamiclights/function/install.mcfunction b/data/dynamiclights/function/install.mcfunction index b4b306f..8e5dd14 100644 --- a/data/dynamiclights/function/install.mcfunction +++ b/data/dynamiclights/function/install.mcfunction @@ -74,5 +74,6 @@ scoreboard players set dynamiclights load.status 18 advancement revoke @a only tschipcraft:menu advancement revoke @a only dynamiclights:toggle_enable -## Schedule main function +## Schedule main and loop function schedule function dynamiclights:internal/main 5t +schedule function dynamiclights:internal/loop 10s diff --git a/data/dynamiclights/function/internal/loop.mcfunction b/data/dynamiclights/function/internal/loop.mcfunction new file mode 100644 index 0000000..86cee9b --- /dev/null +++ b/data/dynamiclights/function/internal/loop.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft +# Loop to ensure all new players can run the triggers + +schedule function dynamiclights:internal/loop 4s + +scoreboard players enable @a ts.dl.toggle +scoreboard players enable @a tschipcraft.menu diff --git a/data/dynamiclights/function/internal/main.mcfunction b/data/dynamiclights/function/internal/main.mcfunction index 06b3684..dd70680 100644 --- a/data/dynamiclights/function/internal/main.mcfunction +++ b/data/dynamiclights/function/internal/main.mcfunction @@ -1,4 +1,4 @@ -## by Tschipcraft +##by Tschipcraft # Schedule for next tick schedule function dynamiclights:internal/main 1t diff --git a/data/dynamiclights/function/internal/version_checker/start.mcfunction b/data/dynamiclights/function/internal/version_checker/start.mcfunction index 08017b9..6bb03ed 100644 --- a/data/dynamiclights/function/internal/version_checker/start.mcfunction +++ b/data/dynamiclights/function/internal/version_checker/start.mcfunction @@ -2,7 +2,8 @@ scoreboard objectives add ts.dl.version dummy execute store result score $global ts.dl.version run data get entity @r DataVersion -execute unless score $global tvc_ignore matches 1 if score $global ts.dl.version matches 4000.. run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"?","bold":true,"color":"gold"},{"text":" Future unknown Minecraft version above 1.21 detected! This data pack/mod may not work correctly anymore! Please make sure to check for updates in the menu! (","color":"gold"},{"text":"/trigger tschipcraft.menu","underlined":true,"color":"gold","clickEvent":{"action":"run_command","value":"/trigger tschipcraft.menu"},"hoverEvent":{"action":"show_text","contents":"Click here"}},{"text":")","color":"gold"}] +execute unless score $global tvc_ignore matches 1 if score $global ts.dl.version matches 4100.. run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"?","bold":true,"color":"gold"},{"text":" Future unknown Minecraft version above 1.21.3 detected! This data pack/mod may not work correctly anymore! Please make sure to check for updates in the menu! (","color":"gold"},{"text":"/trigger tschipcraft.menu","underlined":true,"color":"gold","clickEvent":{"action":"run_command","value":"/trigger tschipcraft.menu"},"hoverEvent":{"action":"show_text","contents":"Click here"}},{"text":")","color":"gold"}] +# Note: 1.17x-1.20x uses the old folder names (function -> functions) # Curios Compatibility scoreboard players reset $curios_install ts.dl.version diff --git a/data/dynamiclights/functions/install.mcfunction b/data/dynamiclights/functions/install.mcfunction index abd79bf..9b6124d 100644 --- a/data/dynamiclights/functions/install.mcfunction +++ b/data/dynamiclights/functions/install.mcfunction @@ -75,7 +75,7 @@ scoreboard players set dynamiclights load.status 18 advancement revoke @a only dynamiclights:interacted_with_item_frame advancement revoke @a only dynamiclights:toggle_enable -## Schedule functions +## Schedule main and loop function schedule function dynamiclights:internal/main 5t schedule function dynamiclights:internal/loop 4t diff --git a/data/dynamiclights/functions/internal/loop.mcfunction b/data/dynamiclights/functions/internal/loop.mcfunction index 16c886e..b8cd96b 100644 --- a/data/dynamiclights/functions/internal/loop.mcfunction +++ b/data/dynamiclights/functions/internal/loop.mcfunction @@ -1,6 +1,10 @@ ##by Tschipcraft -# Resets dynamic item holders such as item frames +schedule function dynamiclights:internal/loop 4s + +# Reset dynamic item holders such as item frames scoreboard players reset @e[type=#dynamiclights:reparse] ts.dl.i.type -schedule function dynamiclights:internal/loop 4s +# Ensure all new players can run the triggers +scoreboard players enable @a ts.dl.toggle +scoreboard players enable @a tschipcraft.menu diff --git a/data/dynamiclights/functions/internal/main.mcfunction b/data/dynamiclights/functions/internal/main.mcfunction index 42e1a20..d0b6074 100644 --- a/data/dynamiclights/functions/internal/main.mcfunction +++ b/data/dynamiclights/functions/internal/main.mcfunction @@ -1,4 +1,4 @@ -## by Tschipcraft +##by Tschipcraft # Schedule for next tick schedule function dynamiclights:internal/main 1t diff --git a/data/dynamiclights/functions/internal/version_checker/start.mcfunction b/data/dynamiclights/functions/internal/version_checker/start.mcfunction index b7a2bef..f03d0ee 100644 --- a/data/dynamiclights/functions/internal/version_checker/start.mcfunction +++ b/data/dynamiclights/functions/internal/version_checker/start.mcfunction @@ -2,6 +2,7 @@ scoreboard objectives add ts.dl.version dummy execute store result score $global ts.dl.version run data get entity @r DataVersion +# Note: 1.21+ uses the new folder names (functions -> function) #execute if score $global ts.dl.version matches 2976..3106 run say 1.19 detected! #execute if score $global ts.dl.version matches 2731..2975 run say 1.18 detected! #execute if score $global ts.dl.version matches 2587..2730 run say 1.17 detected! diff --git a/pack.mcmeta b/pack.mcmeta index 54211dd..1592ae9 100644 --- a/pack.mcmeta +++ b/pack.mcmeta @@ -2,7 +2,7 @@ "id": "dynamiclights", "pack": { "pack_format": 15, - "supported_formats": [7,48], + "supported_formats": [7,57], "description": "Tschipcraft's Dynamic Lights \n└ v${version} ● mc${mc_version}" }, "overlays": {