Skip to content

Commit 28ea96e

Browse files
committed
Split entity execution logic
- Split entity execution logic between players and non-players, capping non-player entities at 1000, and reducing dynamic light radius around players from 65 to 55 blocks to include fewer entities (#84) - Fixed an issue where a structure void item would sometimes flicker below players with an equipped Curios slot by offsetting the armor stand used for parsing vertically (closes #85) - Moved some Fabric mod recommendations to 'suggests' - Hardcoded Forge version range to [1.17,1.21.5] - Adjusted CD workflow to upload Forge version separately - Updated README
1 parent 87b566c commit 28ea96e

File tree

16 files changed

+86
-56
lines changed

16 files changed

+86
-56
lines changed

.github/workflows/cd.yml

Lines changed: 55 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,29 @@ jobs:
250250
datapack
251251
files: |
252252
./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-datapack.zip
253+
254+
- name: Upload Forge mod version to Modrinth # Forge mod version is uploaded separately atm due to it not being compatible with Minecraft 1.21.6 or above
255+
id: upload_forge_modrinth_mod
256+
uses: Kir-Antipov/mc-publish@v3.3
257+
if: steps.check_mod_folder.outputs.files_exists == 'true' && github.event.inputs.dry_run == 'false'
258+
with:
259+
modrinth-id: 7YjclEGc
260+
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
261+
game-versions: |
262+
>=1.17 <=1.21.5
263+
game-version-filter: any
264+
fail-mode: skip
265+
266+
name: "[Mod] Release v${{ github.event.inputs.tag }}"
267+
version: ${{ github.event.inputs.tag }}+mod
268+
changelog-file: CHANGES.md
269+
270+
dependencies: |
271+
midnightlib(optional){modrinth:codAaoxh}
272+
loaders: |
273+
forge
274+
files: |
275+
./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-mod.jar
253276
254277
- name: Upload mod version to Modrinth
255278
id: upload_modrinth_mod
@@ -275,7 +298,6 @@ jobs:
275298
loaders: |
276299
fabric
277300
quilt
278-
forge
279301
neoforge
280302
files: |
281303
./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-mod.jar
@@ -300,7 +322,7 @@ jobs:
300322
files: |
301323
./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-datapack.zip
302324
303-
- name: Upload mod version to CurseForge
325+
- name: Upload mod version to CurseForge # Duplicate uploads sadly don't work on CurseForge
304326
id: upload_curseforge_mod
305327
uses: Kir-Antipov/mc-publish@v3.3
306328
if: steps.check_mod_folder.outputs.files_exists == 'true' && github.event.inputs.dry_run == 'false'
@@ -355,42 +377,43 @@ jobs:
355377
run: |
356378
echo "Building summary..."
357379
if [ "${{ job.status }}" == "success" ]; then
358-
SUMMARY_CONTENT="<picture>
359-
<source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/light-theme/success.svg\">
360-
<img alt=\"✅ Success\" src=\"https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/dark-theme/success.svg\">
361-
</picture><br>
380+
SUMMARY_CONTENT="<picture>
381+
<source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/light-theme/success.svg\">
382+
<img alt=\"✅ Success\" src=\"https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/dark-theme/success.svg\">
383+
</picture><br>
362384
363-
**${{ github.event.repository.name }} v${{ github.event.inputs.tag }}** for **Minecraft ${{ env.MC_HUMAN_VERSION_RANGE }}** published successfully!
385+
**${{ github.event.repository.name }} v${{ github.event.inputs.tag }}** for **Minecraft ${{ env.MC_HUMAN_VERSION_RANGE }}** published successfully!
364386
365-
[View Changelog](https://github.com/${{ github.repository }}/blob/v${{ github.event.inputs.tag }}/CHANGES.md)
387+
[View Changelog](https://github.com/${{ github.repository }}/blob/v${{ github.event.inputs.tag }}/CHANGES.md)
366388
367-
**Downloads:**
368-
"
389+
**Downloads:**
390+
"
369391
370-
if [ -n "${{ steps.upload_modrinth_dp.outputs.modrinth-url }}" ]; then
371-
SUMMARY_CONTENT+="- [Modrinth (Data Pack)](${{ steps.upload_modrinth_dp.outputs.modrinth-url }})
372-
"
373-
fi
374-
if [ -n "${{ steps.upload_modrinth_mod.outputs.modrinth-url }}" ]; then
375-
SUMMARY_CONTENT+="- [Modrinth (Mod)](${{ steps.upload_modrinth_mod.outputs.modrinth-url }})
376-
"
377-
fi
378-
if [ -n "${{ steps.upload_curseforge_dp.outputs.curseforge-url }}" ]; then
379-
SUMMARY_CONTENT+="- [CurseForge (Data Pack)](${{ steps.upload_curseforge_dp.outputs.curseforge-url }})
380-
"
381-
fi
382-
if [ -n "${{ steps.upload_curseforge_mod.outputs.curseforge-url }}" ]; then
383-
SUMMARY_CONTENT+="- [CurseForge (Mod)](${{ steps.upload_curseforge_mod.outputs.curseforge-url }})
384-
"
385-
fi
386-
if [ -n "${{ steps.upload_github.outputs.github-url }}" ]; then
387-
SUMMARY_CONTENT+="- [GitHub Releases](${{ steps.upload_github.outputs.github-url }})
388-
"
389-
fi
392+
if [ -n "${{ steps.upload_modrinth_dp.outputs.modrinth-url }}" ]; then
393+
SUMMARY_CONTENT+="- [Modrinth (Data Pack)](${{ steps.upload_modrinth_dp.outputs.modrinth-url }})
394+
"
395+
fi
396+
if [ -n "${{ steps.upload_modrinth_mod.outputs.modrinth-url }}" ]; then
397+
SUMMARY_CONTENT+="- [Modrinth (Mod)](${{ steps.upload_modrinth_mod.outputs.modrinth-url }})
398+
"
399+
fi
400+
if [ -n "${{ steps.upload_curseforge_dp.outputs.curseforge-url }}" ]; then
401+
SUMMARY_CONTENT+="- [CurseForge (Data Pack)](${{ steps.upload_curseforge_dp.outputs.curseforge-url }})
402+
"
403+
fi
404+
if [ -n "${{ steps.upload_curseforge_mod.outputs.curseforge-url }}" ]; then
405+
SUMMARY_CONTENT+="- [CurseForge (Mod)](${{ steps.upload_curseforge_mod.outputs.curseforge-url }})
406+
"
407+
fi
408+
if [ -n "${{ steps.upload_github.outputs.github-url }}" ]; then
409+
SUMMARY_CONTENT+="- [GitHub Releases](${{ steps.upload_github.outputs.github-url }})
410+
"
411+
fi
412+
413+
echo -e "$SUMMARY_CONTENT" >> $GITHUB_STEP_SUMMARY
390414
391-
echo -e "$SUMMARY_CONTENT" >> $GITHUB_STEP_SUMMARY
392415
else
393-
cat << EOF >> $GITHUB_STEP_SUMMARY
416+
cat << EOF >> $GITHUB_STEP_SUMMARY
394417
<picture>
395418
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/light-theme/error.svg">
396419
<img alt="❌ Error" src="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/dark-theme/error.svg">

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ jobs:
290290
run: |
291291
echo "Building summary..."
292292
if [ "${{ job.status }}" == "success" ]; then
293-
cat << EOF >> $GITHUB_STEP_SUMMARY
293+
cat << EOF >> $GITHUB_STEP_SUMMARY
294294
<picture>
295295
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/light-theme/success.svg">
296296
<img alt="✅ Success" src="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/dark-theme/success.svg">
@@ -304,12 +304,12 @@ jobs:
304304
EOF
305305
306306
else
307-
cat << EOF >> $GITHUB_STEP_SUMMARY
307+
cat << EOF >> $GITHUB_STEP_SUMMARY
308308
<picture>
309309
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/light-theme/error.svg">
310310
<img alt="❌ Error" src="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/dark-theme/error.svg">
311311
</picture><br>
312312
313-
The build v${{ env.TAG }} for mc${{ env.MC_HUMAN_VERSION_RANGE }} failed! Please check the action logs for details.
313+
The build **v${{ env.TAG }}** for **Minecraft ${{ env.MC_HUMAN_VERSION_RANGE }}** failed! Please check the action logs for details.
314314
EOF
315315
fi

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- **Added support for Minecraft 1.21.7** 💿
1+
- **Fixed an issue where a structure void item would sometimes flicker below players with an equipped Curios slot** 🔧 (closes [#85](https://github.com/Tschipcraft/dynamiclights/issues/85))
2+
- Optimized execution by separating logic for players and non-players, capping non-player entities at 1000, and reducing the dynamic light radius around players from 65 to 55 blocks to include fewer entities ([#84](https://github.com/Tschipcraft/dynamiclights/issues/84))

META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ features={ java_version = "[17,)" }
3131
[[dependencies.dynamiclights]]
3232
modId="minecraft"
3333
mandatory=true
34-
versionRange="${mc_version_range_forge}"
34+
versionRange="[1.17,1.21.5]"
3535
ordering="NONE"
3636
side="BOTH"
3737

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
## Features
1515

16-
This data pack/mod brings **dynamic lighting** to Minecraft without any client-side requirements. Supported entities and items (like torches, glowstone, or enchanted gear), held or worn by players, mobs, or placed in item frames, will emit real light as they move, using the [light block](https://minecraft.wiki/w/Light_(block)) added in Snapshot 21w13a. Because of this, the dynamic lights are limited to the block grid. (see [#9](https://github.com/Tschipcraft/dynamiclights/issues/9) for more information)
16+
This data pack/mod brings dynamic lighting to Minecraft without any client-side requirements. Supported entities and items (like torches, glowstone, or enchanted gear), held or worn by players, mobs, or placed in item frames, will emit light using the [light block](https://minecraft.wiki/w/Light_(block)) added in Snapshot 21w13a. Because of this, the dynamic lights are limited to the block grid. (see [#9](https://github.com/Tschipcraft/dynamiclights/issues/9) for more information)
1717

1818
* [**47+ supported vanilla items**](https://github.com/Tschipcraft/dynamiclights/wiki/Supported-Items) out of the box
1919
* **Multiple light levels**: 3, 6, 9, 12, and 15

data/dynamiclights/function/internal/main.mcfunction

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ schedule function dynamiclights:internal/main 1t
77
tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove
88

99
# Detect explosions
10-
execute as @e[type=minecraft:tnt] at @s run function dynamiclights:internal/explosion_detection/tnt
10+
execute as @e[type=minecraft:tnt,limit=10] at @s run function dynamiclights:internal/explosion_detection/tnt
1111

1212
# Core
13-
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
13+
execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @a[gamemode=!spectator,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui,tag=!ts.dl.ignore] at @s run function dynamiclights:internal/main_exec_pass
14+
15+
execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!minecraft:player,type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui,tag=!ts.dl.ignore,tag=!ts.sa.hidden,limit=1000] at @s run function dynamiclights:internal/main_exec
1416

1517
# Clear old lights
1618
execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamiclights:internal/remove_light

data/dynamiclights/function/internal/main_exec.mcfunction

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## Ghast
44
# Ghasts are excluded from the limited range, since shoot timer desynchronizes
5-
execute if score $enable_ghast ts.dl.settings matches 1..2 if entity @s[type=minecraft:ghast] at @s run function dynamiclights:internal/ghast
5+
execute if score $enable_ghast ts.dl.settings matches 1..2 as @s[type=minecraft:ghast] at @s run function dynamiclights:internal/ghast
66

77
## Check to avoid placing inside shulkers (#20)
8-
execute if entity @s[type=minecraft:shulker_bullet] align xyz positioned ~0.5 ~ ~0.5 store result score @s ts.dl.shulker if entity @e[type=minecraft:shulker,distance=..0.1]
8+
execute as @s[type=minecraft:shulker_bullet] align xyz positioned ~0.5 ~ ~0.5 store result score @s ts.dl.shulker if entity @e[type=minecraft:shulker,distance=..0.1,limit=1]
99

1010
## Range limit
1111
execute if score $unlimited ts.dl.settings matches 1..2 unless entity @s[type=minecraft:shulker_bullet,scores={ts.dl.shulker=1}] run function dynamiclights:internal/main_exec_pass
12-
execute unless score $unlimited ts.dl.settings matches 1..2 unless entity @s[type=minecraft:shulker_bullet,scores={ts.dl.shulker=1}] if entity @p[gamemode=!spectator,distance=..65] run function dynamiclights:internal/main_exec_pass
12+
execute unless score $unlimited ts.dl.settings matches 1..2 unless entity @s[type=minecraft:shulker_bullet,scores={ts.dl.shulker=1}] if entity @p[gamemode=!spectator,distance=..55] run function dynamiclights:internal/main_exec_pass

data/dynamiclights/function/internal/sources/mod_support/curios/parse.mcfunction

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
##by Tschipcraft
22

3-
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}
3+
summon armor_stand ~ -65 ~ {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}
44

55
# Copy NBT data
66
data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 HandItems[0] set from storage dynamiclights:curios stacks[0].StacksHandler.Stacks.Items[0]

data/dynamiclights/function/internal/sources/parse/main.mcfunction

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
##by Tschipcraft
22

3-
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"],equipment:{mainhand:{id:"minecraft:structure_void",count:1}},DisabledSlots:4144959}
3+
summon armor_stand ~ -65 ~ {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"],equipment:{mainhand:{id:"minecraft:structure_void",count:1}},DisabledSlots:4144959}
44

55
# Copy NBT data
66
execute as @s[type=minecraft:falling_block] run data modify entity c295ddee-4c15-4e5b-83ba-2fbce873a1d5 equipment.mainhand.id set from entity @s BlockState.Name

data/dynamiclights/functions/internal/main.mcfunction

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ schedule function dynamiclights:internal/main 1t
1010
tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove
1111

1212
# Detect explosions
13-
execute as @e[type=minecraft:tnt] at @s run function dynamiclights:internal/explosion_detection/tnt
13+
execute as @e[type=minecraft:tnt,limit=10] at @s run function dynamiclights:internal/explosion_detection/tnt
1414

1515
# Core
16-
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
16+
execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @a[gamemode=!spectator,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui,tag=!ts.dl.ignore] at @s run function dynamiclights:internal/main_exec_pass
17+
18+
execute if score $enable ts.dl.settings matches 1..2 unless score $global ts.dl.tnt.fuse matches 1 as @e[type=!minecraft:player,type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui,tag=!ts.dl.ignore,tag=!ts.sa.hidden,limit=1000] at @s run function dynamiclights:internal/main_exec
1719

1820
# Clear old lights
1921
execute as @e[type=minecraft:marker,tag=ts.dl.remove] at @s run function dynamiclights:internal/remove_light

0 commit comments

Comments
 (0)