Skip to content

Commit

Permalink
Final changes for v1.5
Browse files Browse the repository at this point in the history
- Inactive lights won't be preserved anymore due to theoretical problems upon uninstallation
- Added more ignore tags from the MC Datapack Discord Server conventions just in case
- Moved Glow Lichen from light level 9 to 6
- Updated README.md
- Code cleanup
  • Loading branch information
Tschipcraft committed Feb 25, 2023
1 parent 938f29d commit ae69701
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 40 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,55 @@
</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://datapacks-pre-product.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://www.curseforge.com/minecraft/texture-packs/dynamic-lights"><img src="https://cf.way2muchnoise.eu/full_<REPLACE>_downloads.svg?badge_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>
</p>

> A data pack for 1.17x-1.19x
<details>
<summary>YouTube showcase</summary>
<a href="http://www.youtube.com/watch?v=bzmqpgfQ7jo">
<img alt="Dynamic Lights thumbnail" width=50% src="https://tschipcraft.ddns.net/mod_resources/youtube_preview.php?id=bzmqpgfQ7jo" title="Watch on YouTube">
</a>
</details>

## Features

Burning entities/items such as torches or lanterns emit light due to the new light block added in 21w13a.
Supported entities and items such as torches or lanterns will emit light by using the light block added in 21w13a.

**Supported Items:** Torches, Lanterns, Glowstone, Glowstone Dust, Lava Buckets, Sea Lanterns, Glow Ink Sacs, Glow Berries, Glow Item Frames, Glow Lichen, Jack o'Lanterns, Shroomlights, Redstone Torches, Soul Torches, Soul Lanterns, End Rods
**Supported Items:** Torches, Lanterns, Campfires, Glowstone, Glowstone Dust, Blaze Rods, Blaze Powder, Spectral Arrows, Lava Buckets, Sea Lanterns, Prismarine Crystals, Froglights, Glow Ink Sacs, Glow Berries, Glow Item Frames, Glow Lichen, Jack o'Lanterns, Shroomlights, End Rods, End Crystals, Fire Charge, Ametyhst Shards, Nether Stars, Ender Chests and Beacons

**Always glowing entities:** Glow Squids, Blazes, Glow Item Frames, Ignited Creepers, TnT
Additionally, all enchanted items will emit light level 6 while Fire Aspect enchanted items will emit light level 9.

**Always glowing entities:** Allays, Glow Squids, Glow Item Frames, Blazes, TNT, End Crystals, Fire Balls, Spectral Arrows, Firework Rockets and Flying Wither Skulls

No Optifine needed!

[-> For more information, 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.

Now also available on Modrinth!
Also available on Modrinth and CurseForge!

<a href="https://datapacks-pre-product.modrinth.com/datapack/dynamic-lights">
<a href="https://modrinth.com/datapack/dynamic-lights">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/modrinth/art/blob/main/Branding/Badge/badge-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/modrinth/art/blob/main/Branding/Badge/badge-light.svg">
<img alt="Download on Modrinth" src="https://github.com/modrinth/art/blob/main/Branding/Badge/badge-dark.svg">
</picture>
</a>
<a href="https://www.curseforge.com/minecraft/texture-packs/dynamic-lights">
<img alt="Download on CurseForge" src="https://i.imgur.com/zcIcoGb.png">
</a>


## Updates

To check for updates use `/trigger menu` and hit the Check for Updates button. There is also a **Reset** and an **Uninstall** button.
If you are looking for a mod version, use something like [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) or Optifine for better performance.


## Compatibility
## Manage

Data packs are usually pretty compatible with newer versions of the game. This data pack however also features a version checker which notifies you, if you are playing with an (to the data pack) unknown version. If the data pack works fine and I'm just too lazy to update it in time, you can turn it off with the command `/scoreboard players set tvc_ignore global 1`
To check for updates use `/trigger tschipcraft.menu` and hit the Check for Updates button. There is also a **Reset** and an **Uninstall** button.
2 changes: 1 addition & 1 deletion data/dynamiclights/functions/delete.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

execute if block ~ ~ ~ light[waterlogged=true] run fill ~ ~ ~ ~ ~ ~ water replace light
execute if block ~ ~ ~ light[waterlogged=false] run fill ~ ~ ~ ~ ~ ~ air replace light
kill @s[type=marker,tag=ts.dynamiclights.light]
kill @s[type=minecraft:marker,tag=ts.dynamiclights.light]
3 changes: 3 additions & 0 deletions data/dynamiclights/functions/install.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ scoreboard objectives add tschipcraft.menu trigger
scoreboard objectives add tvc_ignore dummy

schedule function dynamiclights:main 5t

# Break for any version below Minecraft 1.17
execute if entity @e[type=minecraft:marker]
14 changes: 8 additions & 6 deletions data/dynamiclights/functions/main.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
tag @e[type=minecraft:marker,tag=ts.dynamiclights.light] add ts.dynamiclights.old_light

# Core
execute unless score global ts.dl.unlimited matches 1 as @e at @s if entity @a[gamemode=!spectator,distance=..65] run function dynamiclights:core
execute if score global ts.dl.unlimited matches 1 as @e at @s run function dynamiclights:core
#execute as @e at @s run function dynamiclights:core
execute unless score $global ts.dl.unlimited matches 1 as @e at @s if entity @a[gamemode=!spectator,distance=..65] run function dynamiclights:core
execute if score $global ts.dl.unlimited matches 1 as @e at @s run function dynamiclights:core

# Clearing old lights and repeat
execute unless score global ts.dl.unlimited matches 1 as @e[type=minecraft:marker,tag=ts.dynamiclights.old_light] at @s if entity @a[gamemode=!spectator,distance=..65] run function dynamiclights:delete
execute if score global ts.dl.unlimited matches 1 as @e[type=minecraft:marker,tag=ts.dynamiclights.old_light] at @s run function dynamiclights:delete
# Clearing old lights
execute as @e[type=minecraft:marker,tag=ts.dynamiclights.old_light] at @s run function dynamiclights:delete
# Not cleaning lights farther than 65 blocks (code below) looks better, but leaves light blocks behind, that could remain after uninstall - maybe add option to enable
#execute unless score $global ts.dl.unlimited matches 1 as @e[type=minecraft:marker,tag=ts.dynamiclights.old_light] at @s if entity @a[gamemode=!spectator,distance=..65] run function dynamiclights:delete
#execute if score $global ts.dl.unlimited matches 1 as @e[type=minecraft:marker,tag=ts.dynamiclights.old_light] at @s run function dynamiclights:delete

# Menu
function dynamiclights:menu

# Repeat
schedule function dynamiclights:main 1t
2 changes: 1 addition & 1 deletion data/dynamiclights/functions/messages/welcome.mcfunction
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## by Tschipcraft

tellraw @s ["",{"text":"➤ Dynamic Lights by Tschipcraft installed!","italic":false,"color":"green"},{"text":"\n"},{"text":"[How to use]","color":"light_purple","clickEvent":{"action":"run_command","value":"/trigger ts.dl.mess.how"},"hoverEvent":{"action":"show_text","contents":"Click here"}},{"text":" "},{"text":"[Reset]","color":"red","clickEvent":{"action":"run_command","value":"/function dynamiclights:reset"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Reset the whole data pack.","color":"white"}]}},{"text":" "},{"text":"[Uninstall]","color":"dark_red","clickEvent":{"action":"run_command","value":"/function dynamiclights:uninstall"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Uninstall the data pack. ","color":"white"},{"text":"Note: No entities/items will glow anymore!","color":"red"}]}},{"text":" "},{"text":"[Check for updates] ","color":"blue","clickEvent":{"action":"open_url","value":"https://tschipcraft.ddns.net/update/test.html?pack=dynamiclights&v=1.5"},"hoverEvent":{"action":"show_text","contents":"Click here to check for updates."}}]
tellraw @s ["",{"text":"➤ Dynamic Lights v1.5 by Tschipcraft installed!","italic":false,"color":"green"},{"text":"\n"},{"text":"[How to use]","color":"light_purple","clickEvent":{"action":"run_command","value":"/trigger ts.dl.mess.how"},"hoverEvent":{"action":"show_text","contents":"Click here"}},{"text":" "},{"text":"[Reset]","color":"red","clickEvent":{"action":"run_command","value":"/function dynamiclights:reset"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Reset the whole data pack.","color":"white"}]}},{"text":" "},{"text":"[Uninstall]","color":"dark_red","clickEvent":{"action":"run_command","value":"/function dynamiclights:uninstall"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Uninstall the data pack. ","color":"white"},{"text":"Note: No entities/items will glow anymore!","color":"red"}]}},{"text":" "},{"text":"[Report an issue]","color":"gold","clickEvent":{"action":"open_url","value":"https://github.com/Tschipcraft/dynamiclights/issues/new/choose"},"hoverEvent":{"action":"show_text","contents":"Click here to report an issue."}},{"text":" "},{"text":"[Check for updates]","color":"blue","clickEvent":{"action":"open_url","value":"https://tschipcraft.ddns.net/update/test.html?pack=dynamiclights&v=1.5"},"hoverEvent":{"action":"show_text","contents":"Click here to check for updates."}}]
scoreboard players set @s ts.dl.mess.welc 1
scoreboard players enable @s ts.dl.mess.how
4 changes: 1 addition & 3 deletions data/dynamiclights/functions/summon_light.mcfunction
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
##by Tschipcraft

execute align xyz positioned ~0.5 ~ ~0.5 run summon minecraft:marker ~ ~ ~ {Tags:["ts.dynamiclights.light","ts.dynamiclights.new_light","global.ignore","smithed.entity","smithed.strict"],Invulnerable:1b}
execute align xyz positioned ~0.5 ~ ~0.5 run summon minecraft:marker ~ ~ ~ {Tags:["ts.dynamiclights.light","ts.dynamiclights.new_light","global.ignore","global.ignore.kill","global.ignore.pos","smithed.entity","smithed.strict"],Invulnerable:1b}

# Resolve potential problems and place the light
execute as @e[type=minecraft:marker,tag=ts.dynamiclights.new_light] at @s run function dynamiclights:light/core

#say A light triggered!
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
##by Tschipcraft

execute align xyz positioned ~0.5 ~ ~0.5 run summon minecraft:marker ~ ~ ~ {Tags:["ts.dynamiclights.light","ts.dynamiclights.new_light","ts.dynamiclights.redstone_light","global.ignore","smithed.entity","smithed.strict"],Invulnerable:1b}
execute align xyz positioned ~0.5 ~ ~0.5 run summon minecraft:marker ~ ~ ~ {Tags:["ts.dynamiclights.light","ts.dynamiclights.new_light","ts.dynamiclights.redstone_light","global.ignore","global.ignore.kill","global.ignore.pos","smithed.entity","smithed.strict"],Invulnerable:1b}

# Resolve potential problems and place the light
execute as @e[type=minecraft:marker,tag=ts.dynamiclights.new_light] at @s run function dynamiclights:light/core

#say A redstone light triggered!
4 changes: 1 addition & 3 deletions data/dynamiclights/functions/summon_soul_light.mcfunction
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
##by Tschipcraft

execute align xyz positioned ~0.5 ~ ~0.5 run summon minecraft:marker ~ ~ ~ {Tags:["ts.dynamiclights.light","ts.dynamiclights.new_light","ts.dynamiclights.soul_light","global.ignore","smithed.entity","smithed.strict"],Invulnerable:1b}
execute align xyz positioned ~0.5 ~ ~0.5 run summon minecraft:marker ~ ~ ~ {Tags:["ts.dynamiclights.light","ts.dynamiclights.new_light","ts.dynamiclights.soul_light","global.ignore","global.ignore.kill","global.ignore.pos","smithed.entity","smithed.strict"],Invulnerable:1b}

# Resolve potential problems and place the light
execute as @e[type=minecraft:marker,tag=ts.dynamiclights.new_light] at @s run function dynamiclights:light/core

#say A soul light triggered!
20 changes: 10 additions & 10 deletions data/dynamiclights/functions/version_checker.mcfunction
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
##by Tschipcraft

scoreboard objectives add ts_version dummy
execute store result score global ts_version run data get entity @r DataVersion
execute unless score global tvc_ignore matches 1 if score global mm_version matches 3200.. run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"?","bold":true,"color":"gold"},{"text":" Minecraft version 1.20 or above detected! This data pack may not work correctly anymore! Please make sure to check for updates in the menu! (","color":"gold"},{"text":"/trigger menu","underlined":true,"color":"gold","clickEvent":{"action":"run_command","value":"/trigger menu"},"hoverEvent":{"action":"show_text","contents":"Click here"}},{"text":")","color":"gold"}]
#execute if score global ts_version matches 2976..3106 run say 1.19 detected!
#execute if score global ts_version matches 2731..2975 run say 1.18 detected!
#execute if score global ts_version matches 2587..2730 run say 1.17 detected!
execute if score global ts_version matches 2231..2586 run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.16","color":"red","bold": "true"},{"text":" detected! This pack does not work in 1.16! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":"true"},{"text":"!","color":"red"}]
execute if score global ts_version matches 1977..2230 run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.15","color":"red","bold": "true"},{"text":" detected! This pack does not work in 1.15! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":"true"},{"text":"!","color":"red"}]
execute if score global ts_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 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_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 pack does not work in 1.13! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":"true"},{"text":"!","color":"red"}]
execute store result score $global ts_version run data get entity @r DataVersion
execute unless score $global tvc_ignore matches 1 if score $global ts_version matches 3400.. run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"?","bold":true,"color":"gold"},{"text":" Minecraft version 1.20 or above detected! This data pack 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 if score $global ts_version matches 2976..3106 run say 1.19 detected!
#execute if score $global ts_version matches 2731..2975 run say 1.18 detected!
#execute if score $global ts_version matches 2587..2730 run say 1.17 detected!
execute if score $global ts_version matches 2231..2586 run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.16","color":"red","bold":true},{"text":" detected! This data pack does not work in 1.16! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":true},{"text":"!","color":"red"}]
execute if score $global ts_version matches 1977..2230 run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.15","color":"red","bold": true},{"text":" detected! This data pack does not work in 1.15! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":true},{"text":"!","color":"red"}]
execute if score $global ts_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_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"}]

execute if score global ts_version matches 0 run function dynamiclights:version_retry
execute if score $global ts_version matches 0 run function dynamiclights:version_retry

scoreboard objectives remove ts_version
1 change: 1 addition & 0 deletions data/dynamiclights/tags/items/redstone_light.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"minecraft:nether_star",
"minecraft:blaze_powder",
"minecraft:amethyst_shard",
"minecraft:glow_lichen",
"minecraft:ender_chest"
]
}
1 change: 0 additions & 1 deletion data/dynamiclights/tags/items/soul_light.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"minecraft:glow_ink_sac",
"minecraft:glow_item_frame",
"minecraft:glow_berries",
"minecraft:glow_lichen",
"minecraft:prismarine_crystals",
"minecraft:blaze_rod",
"minecraft:spectral_arrow",
Expand Down

0 comments on commit ae69701

Please sign in to comment.