Skip to content

Commit

Permalink
Support for Snapshot 24w09a
Browse files Browse the repository at this point in the history
- Updated to work with Snapshot 24w0a by utilizing overlays
  - Renamed tag keyword to items and fluids in predicates
  - Switched to testing components rather than nbt in predicates
  - Added an additional overlay to disable light emitting from amethyst trimmed armor until it's possible to check for partial parts of components
- Moved some checks
- Reworded settings entry
- Added alt texts to images in README
- Updated GitHub workflow
  • Loading branch information
Tschipcraft committed Mar 16, 2024
1 parent ade4d78 commit 44d7d5d
Show file tree
Hide file tree
Showing 57 changed files with 1,622 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/check_commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
show-progress: false
- name: Validate commands
uses: mcbeet/check-commands@v1
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- **Update to Minecraft 1.20.5**
- **Implemented a new system for finding valid locations for dynamic lights.** Checks now actively avoid blocking paths of fluids and pistons (closes [#15](https://github.com/Tschipcraft/dynamiclights/issues/15)), interfering with other redstone components and triggering certain block updates (closes [#12](https://github.com/Tschipcraft/dynamiclights/issues/12))
- Gave dynamic light marker entities a custom name ([#19](https://github.com/Tschipcraft/dynamiclights/issues/19))
- Fixed dynamic light position offset for item entities
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Dynamic Lights
</h1>
<p align="center">
<a href="https://github.com/Tschipcraft/dynamiclights/stargazers"><img src="https://img.shields.io/github/stars/Tschipcraft/dynamiclights?colorA=0c0906&colorB=fbc703&style=for-the-badge"></a>
<a href="https://www.curseforge.com/minecraft/texture-packs/tschipcrafts-dynamic-lights"><img src="https://img.shields.io/curseforge/dt/831385?logo=curseforge&label=CurseForge&colorA=0c0906&colorB=fbc703&style=for-the-badge"></a>
<a href="https://modrinth.com/datapack/dynamic-lights"><img src="https://img.shields.io/modrinth/dt/dynamic-lights?label=Modrinth&colorA=0c0906&colorB=fbc703&style=for-the-badge&logo=modrinth"></a>
<a href="https://github.com/Tschipcraft/dynamiclights/releases/latest"><img src="https://img.shields.io/github/downloads/Tschipcraft/dynamiclights/total?logo=github&colorA=0c0906&colorB=fbc703&style=for-the-badge"></a>
<a href="https://github.com/Tschipcraft/dynamiclights/stargazers"><img alt="GitHub Stars" src="https://img.shields.io/github/stars/Tschipcraft/dynamiclights?colorA=0c0906&colorB=fbc703&style=for-the-badge"></a>
<a href="https://www.curseforge.com/minecraft/texture-packs/tschipcrafts-dynamic-lights"><img alt="CurseForge Downloads" src="https://img.shields.io/curseforge/dt/831385?logo=curseforge&label=CurseForge&colorA=0c0906&colorB=fbc703&style=for-the-badge"></a>
<a href="https://modrinth.com/datapack/dynamic-lights"><img alt="Modrinth Downloads" src="https://img.shields.io/modrinth/dt/dynamic-lights?label=Modrinth&colorA=0c0906&colorB=fbc703&style=for-the-badge&logo=modrinth"></a>
<a href="https://github.com/Tschipcraft/dynamiclights/releases/latest"><img alt="GitHub Downloads" src="https://img.shields.io/github/downloads/Tschipcraft/dynamiclights/total?logo=github&colorA=0c0906&colorB=fbc703&style=for-the-badge"></a>
</p>

> A data pack/mod for Minecraft 1.17x-1.20x
> A server-side data pack/mod for Minecraft 1.17x-1.20x
<details>
<summary>YouTube showcase</summary>
Expand All @@ -30,14 +30,17 @@ Additionally, all enchanted items will emit light level 6 while Fire Aspect, Rip

This data pack/mod is completely server-side! No Optifine required!

Since this project is completely server-side, players joining a server with Dynamic Lights installed do not have to install anything on their end for it to work! Nontheless, you can still use the mod on
the client for singleplayer worlds only. Joining a server that has not installed Dynamic Lights will have no effect.

[➜ For available settings and planned features, take a look at the wiki](https://github.com/Tschipcraft/dynamiclights/wiki)


## Installation

Download the latest release from [here](https://github.com/Tschipcraft/dynamiclights/releases/latest) and put the datapack zip file into the `datapacks` folder of your Minecraft world.

This data pack is also available as a mod with an additional global settings menu when installed alongside [MidnightLib](https://modrinth.com/mod/midnightlib). Download the latest release and put the mod .jar file into your `.minecraft/mods` folder.
This data pack is also available as a mod with an additional global config file and settings menu when installed alongside [MidnightLib](https://modrinth.com/mod/midnightlib). Download the latest release and put the mod .jar file into your `.minecraft/mods` folder.

Also available on Modrinth and CurseForge!

Expand Down
4 changes: 2 additions & 2 deletions assets/dynamiclights/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"dynamiclights.midnightconfig.enable_ghast": "Ghasts about to shoot a fireball",
"dynamiclights.midnightconfig.enable_ghast.tooltip": "Default: §aYes§f",
"dynamiclights.midnightconfig.enable_enchanted_items": "Enchanted items",
"dynamiclights.midnightconfig.enable_enchanted_items.tooltip": "Default: §aYes§f\n§6⚠ Note: This may lead to decreased performance of some mob farms.",
"dynamiclights.midnightconfig.enable_enchanted_items.tooltip": "Default: §aYes§f\n§6⚠ Note: Having this option enabled may lead to decreased performance of some mob farms.",
"dynamiclights.midnightconfig.enable_amethyst_trimmed": "Armor trimmed with amethyst",
"dynamiclights.midnightconfig.enable_amethyst_trimmed.tooltip": "Default: §aYes§f\nOnly for Minecraft 1.20+",

"dynamiclights.midnightconfig.enable_fire_aspect": "Items enchanted with Fire Aspect",
"dynamiclights.midnightconfig.enable_fire_aspect.tooltip": "Default: §aYes§f\n§6⚠ Note: This may lead to decreased performance of some mob farms.",
"dynamiclights.midnightconfig.enable_fire_aspect.tooltip": "Default: §aYes§f\n§6⚠ Note: Having this option enabled may lead to decreased performance of some mob farms.",
"dynamiclights.midnightconfig.enable_riptide": "Tridents enchanted with Riptide inside water",
"dynamiclights.midnightconfig.enable_riptide.tooltip": "Default: §aYes§f\nOnly works when Water Sensitivity Check is enabled.",
"dynamiclights.midnightconfig.enable_channeling": "Tridents enchanted with Channeling during a thunderstorm",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##by Tschipcraft

execute if score $enable_sound ts.dl.settings matches 1..2 run playsound minecraft:block.beacon.power_select player @a ~ ~ ~ 0.3
playsound minecraft:block.beacon.power_select player @a ~ ~ ~ 0.3
scoreboard players set @s ts.dl.sound 2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##by Tschipcraft

execute if score $enable_sound ts.dl.settings matches 1..2 run playsound minecraft:block.conduit.activate player @a ~ ~ ~ 0.8
playsound minecraft:block.conduit.activate player @a ~ ~ ~ 0.8
scoreboard players set @s ts.dl.sound 1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##by Tschipcraft

execute if score $enable_sound ts.dl.settings matches 1..2 run playsound minecraft:block.beacon.deactivate player @a ~ ~ ~ 0.3
playsound minecraft:block.beacon.deactivate player @a ~ ~ ~ 0.3
scoreboard players set @s ts.dl.sound 0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##by Tschipcraft

execute if score $enable_sound ts.dl.settings matches 1..2 run playsound minecraft:block.conduit.deactivate player @a ~ ~ ~ 0.3
playsound minecraft:block.conduit.deactivate player @a ~ ~ ~ 0.3
scoreboard players set @s ts.dl.sound 0
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ scoreboard players remove @s ts.dl.tnt.fuse 1
execute if score @s ts.dl.tnt.fuse matches ..1 at @s run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:3,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}

# Detect other TNTs and Observers
execute if block ~1 ~ ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
execute if block ~-1 ~ ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
execute if block ~ ~ ~1 #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
execute if block ~ ~ ~-1 #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
execute if block ~ ~1 ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
execute if block ~ ~-1 ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
#execute if block ~1 ~ ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
#execute if block ~-1 ~ ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
#execute if block ~ ~ ~1 #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
#execute if block ~ ~ ~-1 #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
#execute if block ~ ~1 ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
#execute if block ~ ~-1 ~ #dynamiclights:tnt_exclude unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..1] run summon area_effect_cloud ~ ~ ~ {Radius:0f,RadiusPerTick:0f,RadiusOnUse:0f,Duration:20,DurationOnUse:0,Tags:["global.ignore","global.ignore.kill","global.ignore.pos","smithed.block","ts.dl.explosion"]}
4 changes: 2 additions & 2 deletions data/dynamiclights/functions/internal/main_exec.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

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

## Range limit
execute if score $unlimited ts.dl.settings matches 1..2 unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..20] unless entity @s[type=minecraft:player,gamemode=spectator] run function dynamiclights:internal/main_exec_pass
execute unless score $unlimited ts.dl.settings matches 1..2 if entity @a[gamemode=!spectator,distance=..65] unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..20] unless entity @s[type=minecraft:player,gamemode=spectator] run function dynamiclights:internal/main_exec_pass
execute unless score $unlimited ts.dl.settings matches 1..2 if entity @p[gamemode=!spectator,distance=..65] unless entity @e[type=minecraft:area_effect_cloud,tag=ts.dl.explosion,distance=..20] unless entity @s[type=minecraft:player,gamemode=spectator] run function dynamiclights:internal/main_exec_pass
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ execute as @s[type=minecraft:item,scores={ts.dl.in_water=1}] anchored eyes posit

## Sound cues for trident enchants
scoreboard players add @s ts.dl.sound 0
execute as @s[scores={ts.dl.sound=0},predicate=dynamiclights:entity/has_riptide_trident] run function dynamiclights:internal/enchantments/activate/riptide
execute as @s[scores={ts.dl.sound=1},predicate=!dynamiclights:entity/has_riptide_trident] run function dynamiclights:internal/enchantments/deactivate/riptide
execute if score $enable_sound ts.dl.settings matches 1..2 as @s[scores={ts.dl.sound=0},predicate=dynamiclights:entity/has_riptide_trident] run function dynamiclights:internal/enchantments/activate/riptide
execute if score $enable_sound ts.dl.settings matches 1..2 as @s[scores={ts.dl.sound=1},predicate=!dynamiclights:entity/has_riptide_trident] run function dynamiclights:internal/enchantments/deactivate/riptide

execute as @s[scores={ts.dl.sound=0},predicate=dynamiclights:entity/has_channeling_trident] run function dynamiclights:internal/enchantments/activate/channeling
execute as @s[scores={ts.dl.sound=2},predicate=!dynamiclights:entity/has_channeling_trident] run function dynamiclights:internal/enchantments/deactivate/channeling
execute if score $enable_sound ts.dl.settings matches 1..2 as @s[scores={ts.dl.sound=0},predicate=dynamiclights:entity/has_channeling_trident] run function dynamiclights:internal/enchantments/activate/channeling
execute if score $enable_sound ts.dl.settings matches 1..2 as @s[scores={ts.dl.sound=2},predicate=!dynamiclights:entity/has_channeling_trident] run function dynamiclights:internal/enchantments/deactivate/channeling

## Dispatch light
function dynamiclights:internal/sources/core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

execute if block ~ ~ ~ minecraft:light[waterlogged=true] run fill ~ ~ ~ ~ ~ ~ minecraft:water replace minecraft:light
execute if block ~ ~ ~ minecraft:light[waterlogged=false] run fill ~ ~ ~ ~ ~ ~ minecraft:air replace minecraft:light
execute as @s[type=minecraft:marker,tag=ts.dl.light] at @s unless block ~ ~ ~ minecraft:light run function dynamiclights:internal/kill_marker
execute if entity @s[type=minecraft:marker,tag=ts.dl.light] run function dynamiclights:internal/kill_marker
4 changes: 2 additions & 2 deletions data/dynamiclights/functions/settings/core.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ execute if score $enable_ghast ts.dl.settings matches 0 run tellraw @s [{"text":
execute if score $enable_ghast ts.dl.settings matches -1 run tellraw @s [{"text":"[❌] Ghasts about to shoot a fireball","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_ghast ts.dl.settings matches 2 run tellraw @s [{"text":"[✔] Ghasts about to shoot a fireball","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 $enchanted_items 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":"."},{"text":"\n⚠ Note: This may lead to decreased performance of some mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enchanted_items"}},{"text":"Enchanted items","color":"white"}]
execute if score $enchanted_items 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":"."},{"text":"\n⚠ Note: Having this option enabled may lead to decreased performance of some mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enchanted_items"}},{"text":"Enchanted items","color":"white"}]
execute if score $enchanted_items ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle this feature "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_enchanted_items"}},{"text":"Enchanted items","color":"white"}]
execute if score $enchanted_items ts.dl.settings matches -1 run tellraw @s [{"text":"[❌] Enchanted items","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 $enchanted_items ts.dl.settings matches 2 run tellraw @s [{"text":"[✔] Enchanted items","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}]
Expand All @@ -31,7 +31,7 @@ execute if score $global ts.dl.version matches 3400.. if score $amethyst_trimmed

tellraw @s {"text":"\nEnable additional light emitting from...","bold":true,"color":"white"}

execute if score $fire_aspect 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":"."},{"text":"\n⚠ Note: This may lead to decreased performance of some mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_fire_aspect"}},{"text":"Items enchanted with Fire Aspect","color":"white"}]
execute if score $fire_aspect 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":"."},{"text":"\n⚠ Note: Having this option enabled may lead to decreased performance of some mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_fire_aspect"}},{"text":"Items enchanted with Fire Aspect","color":"white"}]
execute if score $fire_aspect ts.dl.settings matches 0 run tellraw @s [{"text":"[❌] ","bold":true,"color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Click here to toggle this feature "},{"text":"on","color":"green"},{"text":"."}]},"clickEvent":{"action":"run_command","value":"/function dynamiclights:settings/toggle_fire_aspect"}},{"text":"Items enchanted with Fire Aspect","color":"white"}]
execute if score $fire_aspect ts.dl.settings matches -1 run tellraw @s [{"text":"[❌] Items enchanted with Fire Aspect","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 $fire_aspect ts.dl.settings matches 2 run tellraw @s [{"text":"[✔] Items enchanted with Fire Aspect","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
},
{
"//comment": "This part ensures that the campfire item is lit or not. (Compatibility for The Creeper's Code)",
"//comment": "This part ensures that the campfire item is lit. (Compatibility for The Creeper's Code)",
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:entity_properties",
Expand Down

0 comments on commit 44d7d5d

Please sign in to comment.