Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
- Fixed sculk sensors getting triggered upon dynamic light removal (closes #8), location changes and item frame updates
- Fixed overwriting player placed blocks (closes #7)
- Fixed ghast desync when no player is near
- Added new custom license
- Updated curseforge badge
  • Loading branch information
Tschipcraft committed Aug 12, 2023
1 parent 3706bb4 commit 0f3984c
Show file tree
Hide file tree
Showing 27 changed files with 148 additions and 74 deletions.
73 changes: 52 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
MIT License

Copyright (c) 2023 Tschipcraft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Tschipcraft's Custom License for Minecraft Mods, Data Packs and Resource Packs
Version 1.0 - 2023

TL;DR - Not exhaustive, please read the whole license for detailed information:
- Don't steal, don't re-upload, don't spread misinformation.
- Monetized videos, livestreams with this or about this pack and inclusion in modpacks are allowed, as long as credit is given by linking back to official download locations.
- Only use parts or the entire pack in your project, if you ask me and I say yes.

Copyright © 2023 Tschipcraft

This license shall be included in all copies or substantial portions of this project.


Permitted Uses:

1. You are PERMITTED to freely use this project on singleplayer worlds and multiplayer worlds/servers in your Minecraft game.

2. You are PERMITTED to modify this project's code for personal use or on your own private servers.

3. You are PERMITTED to view this project's code, take reference, and learn from it.

4. You are PERMITTED to create content (e.g., videos, livestreams) covering and showcasing this project on websites such as YouTube, Twitch, Instagram, TikTok, etc., or on your own website, IF you provide a prominent link back to at least one of the official download locations ([GitHub](https://github.com/Tschipcraft/dynamiclights), [CurseForge](https://www.curseforge.com/minecraft/texture-packs/tschipcrafts-dynamic-lights), [Modrinth](https://modrinth.com/datapack/dynamic-lights)) in the description or an easily accessible place. You may also monetize this content.

5. You are PERMITTED to include this project in your modpack, IF you link back to at least one of the official download locations ([GitHub](https://github.com/Tschipcraft/dynamiclights), [CurseForge](https://www.curseforge.com/minecraft/texture-packs/tschipcrafts-dynamic-lights), [Modrinth](https://modrinth.com/datapack/dynamic-lights)), or by simply adding this project in the embedded or included mods sections directly on Modrinth and/or CurseForge.

6. You are PERMITTED to use parts or the whole project in your own project (Mod, Data Pack, Resource Pack, Map, Server, etc.), IF you obtain explicit permission from the creator (Tschipcraft) first. To request permission, please contact me via email at tschipcraft@gmail.com or message me directly on Planet Minecraft (https://www.planetminecraft.com/account/pms/new/tschipo), or Discord (@tschipo) and include detailed information about your intentions.


Prohibited Uses:

1. You may NOT redistribute or re-upload this project, modified or unmodified.

2. You may NOT redistribute single parts, files, or standalones of this project.

3. You may NOT claim that this project was made by you.

4. You may NOT spread misinformation about this project, including but not limited to promising not implemented features or support for an unsupported Minecraft version.


Liability and Warranty:

This project is provided "as is," without warranty of any kind, expressed or implied. In no event shall the creator (Tschipcraft) be held liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the project or the use or other dealings in the project.

All works of Tschipcraft are of and owned by Tschipcraft.

By using this project, you agree to abide by the terms of this license. Any violation of the terms will result in the termination of the rights granted hereunder.

Exceptions to this license may be granted, if you have a special case, contact me via email at tschipcraft@gmail.com or message me directly on Planet Minecraft (https://www.planetminecraft.com/account/pms/new/tschipo), or Discord (@tschipo) and include detailed information about your intentions.

This license shall be governed by and construed in accordance with the laws of Germany. Any legal action or proceeding arising under or in connection with this license shall be brought exclusively in the courts of Germany.

This license is subject to change. The latest version of this license will be available at https://github.com/Tschipcraft/dynamiclights/blob/master/LICENSE, and your continued use of the project after changes happen, will constitute your acceptance of the changes.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

## Features

Supported entities and items such as torches or lanterns will emit light by using the 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. Because of this, the dynamic lights are limited to the block grid.

**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, Amethyst Shards, Nether Stars, Ender Chests and Beacons

Additionally, all enchanted items will emit light level 6 while Fire Aspect, Riptide or Channeling enchanted items emit light level 9.

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

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

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

Expand All @@ -41,13 +41,17 @@ Also available on Modrinth and CurseForge!

<a href="https://modrinth.com/datapack/dynamic-lights">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/modrinth/art/main/Branding/Badge/badge-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/modrinth/art/main/Branding/Badge/badge-light.svg">
<img alt="Download on Modrinth" src="https://raw.githubusercontent.com/modrinth/art/main/Branding/Badge/badge-dark.svg">
<source height="72px" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Tschipcraft/badges/main/assets/modrinth-badge-dark.svg">
<source height="72px" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Tschipcraft/badges/main/assets/modrinth-badge-light.svg">
<img height="72px" alt="Download on Modrinth" src="https://raw.githubusercontent.com/modrinth/art/main/Branding/Badge/badge-dark.svg">
</picture>
</a>
<a href="https://www.curseforge.com/minecraft/texture-packs/tschipcrafts-dynamic-lights">
<img alt="Download on CurseForge" src="https://i.imgur.com/zcIcoGb.png">
<picture>
<source height="72px" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Tschipcraft/badges/main/assets/curseforge-badge-dark.svg">
<source height="72px" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Tschipcraft/badges/main/assets/curseforge-badge-light.svg">
<img height="72px" alt="Download on CurseForge" src="https://raw.githubusercontent.com/Tschipcraft/badges/main/assets/curseforge-badge-dark.svg">
</picture>
</a>


Expand Down
5 changes: 5 additions & 0 deletions data/dynamiclights/functions/internal/kill_marker.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##by Tschipcraft

# Prevent vibrations
tp @s ~ 320 ~
kill @s
4 changes: 1 addition & 3 deletions data/dynamiclights/functions/internal/main.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove

# Core
# TODO: Change $unlimited behavior?
execute unless score $unlimited ts.dl.settings matches 1 as @e[tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] at @s if entity @a[gamemode=!spectator,distance=..65] run function dynamiclights:internal/main_exec
execute if score $unlimited ts.dl.settings matches 1 as @e[tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] at @s run function dynamiclights:internal/main_exec
execute as @e[type=!#dynamiclights:dyn_ignore,tag=!smithed.strict,tag=!global.ignore,tag=!global.ignore.gui] 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
Expand Down
27 changes: 4 additions & 23 deletions data/dynamiclights/functions/internal/main_exec.mcfunction
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
##by Tschipcraft

## In water?
scoreboard players add @s ts.dl.in_water 0
execute if score $water_sensitive ts.dl.settings matches 1 as @s[scores={ts.dl.in_water=0}] anchored eyes positioned ^ ^ ^ if predicate dynamiclights:in_water run function dynamiclights:internal/water/enter
execute as @s[scores={ts.dl.in_water=1},type=!minecraft:item] anchored eyes positioned ^ ^ ^ unless predicate dynamiclights:in_water run function dynamiclights:internal/water/exit
execute as @s[scores={ts.dl.in_water=1},type=minecraft:item] anchored eyes positioned ^ ^ ^ positioned ~ ~-0.1 ~ unless predicate dynamiclights:in_water run function dynamiclights:internal/water/exit

## 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 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

## Dispatch light
function dynamiclights:internal/sources/core

# Light block sadly blocks explosion damage
#execute as @s[type=minecraft:creeper,nbt={ignited:1b},tag=!global.ignore,tag=!smithed.strict] at @s run function dynamiclights:summon_light

## Ghast
# Ghasts are excluded from the limited range, since shoot timer desynchronizes
execute as @s[type=minecraft:ghast] at @s run function dynamiclights:internal/ghast

## Extension for More Mobs
execute as @s[type=minecraft:wither_skeleton,tag=ts.mm.magma_1] at @s run function dynamiclights:internal/place_light/6/summon
execute as @s[type=minecraft:wither_skeleton,tag=ts.mm.magma_2] at @s run function dynamiclights:internal/place_light/9/summon
## Range limit
execute if score $unlimited ts.dl.settings matches 1..2 run function dynamiclights:internal/main_exec_pass
execute unless score $unlimited ts.dl.settings matches 1..2 if entity @a[gamemode=!spectator,distance=..65] run function dynamiclights:internal/main_exec_pass
25 changes: 25 additions & 0 deletions data/dynamiclights/functions/internal/main_exec_pass.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
##by Tschipcraft

## In water?
scoreboard players add @s ts.dl.in_water 0
execute if score $water_sensitive ts.dl.settings matches 1..2 as @s[scores={ts.dl.in_water=0}] anchored eyes positioned ^ ^ ^ if predicate dynamiclights:in_water run function dynamiclights:internal/water/enter
execute as @s[scores={ts.dl.in_water=1},type=!minecraft:item] anchored eyes positioned ^ ^ ^ unless predicate dynamiclights:in_water run function dynamiclights:internal/water/exit
execute as @s[scores={ts.dl.in_water=1},type=minecraft:item] anchored eyes positioned ^ ^ ^ positioned ~ ~-0.1 ~ unless predicate dynamiclights:in_water run function dynamiclights:internal/water/exit

## 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 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

## Dispatch light
function dynamiclights:internal/sources/core

# Light block sadly blocks explosion damage
#execute as @s[type=minecraft:creeper,nbt={ignited:1b},tag=!global.ignore,tag=!smithed.strict] at @s run function dynamiclights:summon_light

## Extension for More Mobs
execute as @s[type=minecraft:wither_skeleton,tag=ts.mm.magma_1] at @s run function dynamiclights:internal/place_light/6/summon
execute as @s[type=minecraft:wither_skeleton,tag=ts.mm.magma_2] at @s run function dynamiclights:internal/place_light/9/summon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Checks if the light level from the previous iteration marker is lower than 15
# Renews the previous iteration marker

scoreboard players set #light_exists ts.dl.settings 1
execute if score @s ts.dl.l.level matches ..15 run function dynamiclights:internal/place_light/15/update
tag @s remove ts.dl.remove
scoreboard players set #light_exists ts.dl.settings 1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
##by Tschipcraft
# Places a dynamic light block with light level 15 in the world

kill @s[type=minecraft:marker,tag=ts.dl.light]
# Kill marker if the dynamic light needed position adjustments
execute as @s[type=minecraft:marker,tag=ts.dl.light] run function dynamiclights:internal/kill_marker
# Check if a dynamic light already exists here
scoreboard players set #light_exists ts.dl.settings 0
execute align xyz as @e[type=minecraft:marker,tag=ts.dl.light,distance=..0.1,limit=1,sort=nearest] at @s run function dynamiclights:internal/place_light/15/prev_it/check

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
##by Tschipcraft

tag @s remove ts.dl.new_light
scoreboard players set #light_moved ts.dl.settings 0
execute unless block ~ ~ ~ #dynamiclights:air unless block ~ ~ ~ water[level=0] run function dynamiclights:internal/place_light/resolve_no_space

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##by Tschipcraft
# Summons a new marker entity

execute align xyz positioned ~ ~ ~ run summon minecraft:marker ~ ~ ~ {Tags:["ts.dl.light","global.ignore","global.ignore.kill","global.ignore.pos","smithed.block"],Invulnerable:1b}
execute as @e[type=minecraft:marker,tag=ts.dl.light,sort=nearest,limit=1] at @s run function dynamiclights:internal/place_light/15/summon_exec
execute align xyz run summon minecraft:marker ~ ~ ~ {Tags:["ts.dl.light","ts.dl.new_light","global.ignore","global.ignore.kill","global.ignore.pos","smithed.block"],Invulnerable:1b}
execute align xyz as @e[type=minecraft:marker,tag=ts.dl.new_light,sort=nearest,limit=1] at @s run function dynamiclights:internal/place_light/15/summon_exec
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
# Sets the light level for a marker entity and updates it

scoreboard players set @s ts.dl.l.level 15
execute if block ~ ~ ~ minecraft:light run function dynamiclights:internal/place_light/15/prev_it/update
# Update exising dynamic light block
execute if block ~ ~ ~ minecraft:light if score #light_exists ts.dl.settings matches 1 run function dynamiclights:internal/place_light/15/prev_it/update
# Keep player placed light blocks
execute if block ~ ~ ~ minecraft:light if score #light_exists ts.dl.settings matches 0 run function dynamiclights:internal/kill_marker
# Place new light block
execute unless block ~ ~ ~ minecraft:light run function dynamiclights:internal/place_light/15/place
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Checks if the light level from the previous iteration marker is lower than 6
# Renews the previous iteration marker

scoreboard players set #light_exists ts.dl.settings 1
execute if score @s ts.dl.l.level matches ..6 run function dynamiclights:internal/place_light/6/update
execute as @s[tag=ts.dl.remove] run function dynamiclights:internal/place_light/6/update
tag @s remove ts.dl.remove
scoreboard players set #light_exists ts.dl.settings 1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
##by Tschipcraft
# Places a dynamic light block with light level 6 in the world

kill @s[type=minecraft:marker,tag=ts.dl.light]
# Kill marker if the dynamic light needed position adjustments
execute as @s[type=minecraft:marker,tag=ts.dl.light] run function dynamiclights:internal/kill_marker
# Check if a dynamic light already exists here
scoreboard players set #light_exists ts.dl.settings 0
execute align xyz as @e[type=minecraft:marker,tag=ts.dl.light,distance=..0.1,limit=1,sort=nearest] at @s run function dynamiclights:internal/place_light/6/prev_it/check

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
##by Tschipcraft

tag @s remove ts.dl.new_light
scoreboard players set #light_moved ts.dl.settings 0
execute unless block ~ ~ ~ #dynamiclights:air unless block ~ ~ ~ water[level=0] run function dynamiclights:internal/place_light/resolve_no_space

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##by Tschipcraft
# Summons a new marker entity

execute align xyz positioned ~ ~ ~ run summon minecraft:marker ~ ~ ~ {Tags:["ts.dl.light","global.ignore","global.ignore.kill","global.ignore.pos","smithed.block"],Invulnerable:1b}
execute as @e[type=minecraft:marker,tag=ts.dl.light,sort=nearest,limit=1] at @s run function dynamiclights:internal/place_light/6/summon_exec
execute align xyz positioned ~ ~ ~ run summon minecraft:marker ~ ~ ~ {Tags:["ts.dl.light","ts.dl.new_light","global.ignore","global.ignore.kill","global.ignore.pos","smithed.block"],Invulnerable:1b}
execute align xyz as @e[type=minecraft:marker,tag=ts.dl.new_light,sort=nearest,limit=1] at @s run function dynamiclights:internal/place_light/6/summon_exec
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
# Sets the light level for a marker entity and updates it

scoreboard players set @s ts.dl.l.level 6
execute if block ~ ~ ~ minecraft:light run function dynamiclights:internal/place_light/6/prev_it/update
# Update exising dynamic light block
execute if block ~ ~ ~ minecraft:light if score #light_exists ts.dl.settings matches 1 run function dynamiclights:internal/place_light/6/prev_it/update
# Keep player placed light blocks
execute if block ~ ~ ~ minecraft:light if score #light_exists ts.dl.settings matches 0 run function dynamiclights:internal/kill_marker
# Place new light block
execute unless block ~ ~ ~ minecraft:light run function dynamiclights:internal/place_light/6/place
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Checks if the light level from the previous iteration marker is lower than 9
# Renews the previous iteration marker

scoreboard players set #light_exists ts.dl.settings 1
execute if score @s ts.dl.l.level matches ..9 run function dynamiclights:internal/place_light/9/update
execute as @s[tag=ts.dl.remove] run function dynamiclights:internal/place_light/9/update
tag @s remove ts.dl.remove
scoreboard players set #light_exists ts.dl.settings 1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
##by Tschipcraft
# Places a dynamic light block with light level 9 in the world

kill @s[type=minecraft:marker,tag=ts.dl.light]
# Kill marker if the dynamic light needed position adjustments
execute as @s[type=minecraft:marker,tag=ts.dl.light] run function dynamiclights:internal/kill_marker
# Check if a dynamic light already exists here
scoreboard players set #light_exists ts.dl.settings 0
execute align xyz as @e[type=minecraft:marker,tag=ts.dl.light,distance=..0.1,limit=1,sort=nearest] at @s run function dynamiclights:internal/place_light/9/prev_it/check

Expand Down

0 comments on commit 0f3984c

Please sign in to comment.