Skip to content

Commit

Permalink
Merge pull request #63 from Tschipcraft/dev
Browse files Browse the repository at this point in the history
v1.8.4
  • Loading branch information
Tschipcraft authored Nov 16, 2024
2 parents fce57e3 + 3bd2b7c commit 25c8d27
Show file tree
Hide file tree
Showing 61 changed files with 382 additions and 44 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -91,11 +91,12 @@ 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 }}"
version: ${{ github.event.inputs.tag }}
changelog-file: CHANGES.*
changelog-file: CHANGES.md

loaders: |
datapack
Expand All @@ -109,11 +110,12 @@ 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 }}"
version: ${{ github.event.inputs.tag }}+mod
changelog-file: CHANGES.*
changelog-file: CHANGES.md

dependencies: |
fabric-api(optional){modrinth:P7dR8mSH}
Expand All @@ -134,11 +136,12 @@ 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 }}"
version: ${{ github.event.inputs.tag }}
changelog-file: CHANGES.*
changelog-file: CHANGES.md

loaders: |
datapack
Expand All @@ -152,17 +155,19 @@ 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 }}"
version: ${{ github.event.inputs.tag }}+mod
changelog-file: CHANGES.*
changelog-file: CHANGES.md

dependencies: |
catalogue(optional){curseforge:459701}
catalogue-fabric(optional){curseforge:667377}
midnightlib(optional){curseforge:488090}
java: |
Java 21
Java 17
Java 18
loaders: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions .spyglassrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"env": {
"gameVersion": "1.21"
},
"lint": {
"idOmitDefaultNamespace": ["warning", false],
"nbtTypeCheck": ["warning", "strictly"]
}
}
13 changes: 7 additions & 6 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- **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 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))
- Fixed tschipcraft.menu trigger not being enabled in 1.21+
2 changes: 2 additions & 0 deletions assets/dynamiclights/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions data/dynamiclights/advancement/toggle_enable.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
23 changes: 23 additions & 0 deletions data/dynamiclights/advancements/toggle_enable.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
10 changes: 8 additions & 2 deletions data/dynamiclights/function/install.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -59,15 +60,20 @@ 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

## Set load status
# 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 main and loop function
schedule function dynamiclights:internal/main 5t
schedule function dynamiclights:internal/loop 10s
7 changes: 7 additions & 0 deletions data/dynamiclights/function/internal/loop.mcfunction
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions data/dynamiclights/function/internal/main.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## by Tschipcraft
##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
Expand All @@ -7,10 +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,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

# Repeat
schedule function dynamiclights:internal/main 1t
4 changes: 4 additions & 0 deletions data/dynamiclights/function/internal/sources/core.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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
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
9 changes: 8 additions & 1 deletion data/dynamiclights/function/reset.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ 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
scoreboard objectives add ts.dl.i.type dummy

# Reschedule main function
schedule function dynamiclights:internal/main 5t
Expand Down
9 changes: 9 additions & 0 deletions data/dynamiclights/function/settings/core.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

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_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","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"}

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"}]
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 25c8d27

Please sign in to comment.