Skip to content

Commit

Permalink
Final changes for v1.6
Browse files Browse the repository at this point in the history
- Added options to configure dynamic light sources on the front end (closes #3)
- Added option to turn sound cues off
- Updated GitHub workflow
- Fixed water sensitive items turning off and on when floating on the water surface
- Removed redundant how to use message
  • Loading branch information
Tschipcraft committed Jun 15, 2023
1 parent 61e8f19 commit a641620
Show file tree
Hide file tree
Showing 35 changed files with 207 additions and 110 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,46 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'version of the data pack'
description: 'Version of the data pack'
required: true
default: 'v1.0'
mc_version:
description: 'Minecraft version(s) the data pack runs in'
required: true
default: '1.20'

jobs:
create_data_pack:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3.5.3
- name: Extract tag
id: tag_version
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/}
- name: Extract MC verson
id: mc_version
run: sh .github/workflows/get-mc-version.sh
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Find and replace uninstall file name
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${file_name}"
replace: ${{ github.event.repository.name }}-${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip
regex: false
include: "**uninstall.mcfunction"
- name: Find and replace data pack version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${version}"
replace: ${{ github.event.inputs.tag }}
regex: false

# Check for existence of datapack and/or resourcepack folders.
- name: Check for data folder
id: check_datapack_folder
uses: andstor/file-existence-action@v1
uses: andstor/file-existence-action@v2
with:
files: "data"
- name: Check for assets folder
id: check_assets_folder
uses: andstor/file-existence-action@v1
uses: andstor/file-existence-action@v2
with:
files: "assets"

Expand Down Expand Up @@ -62,7 +76,7 @@ jobs:
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./assetpack.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.inputs.tag }}-mc${{ steps.mc_version.outputs.MC_VERSION }}-resourcepack.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-resourcepack.zip
asset_content_type: application/zip
- name: Upload datapack release asset
uses: actions/upload-release-asset@v1
Expand All @@ -72,5 +86,5 @@ jobs:
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./datapack.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.inputs.tag }}-mc${{ steps.mc_version.outputs.MC_VERSION }}-datapack.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip
asset_content_type: application/zip
36 changes: 0 additions & 36 deletions .github/workflows/get-mc-version.sh

This file was deleted.

10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<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
> A data pack for 1.17x-1.20x
<details>
<summary>YouTube showcase</summary>
Expand All @@ -18,21 +18,19 @@
</a>
</details>

### Update to Minecraft 1.20 is in progress!

## Features

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

**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 enchanted items will emit light level 9.
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

No Optifine needed!

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


## Installation
Expand All @@ -52,8 +50,6 @@ Also available on Modrinth and CurseForge!
<img alt="Download on CurseForge" src="https://i.imgur.com/zcIcoGb.png">
</a>

If you are looking for a mod version, use something like [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) or Optifine for better performance.


## Manage

Expand Down
15 changes: 4 additions & 11 deletions data/dynamiclights/functions/install.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,21 @@ scoreboard objectives add ts.dl.i.is_chann dummy

scoreboard objectives add ts.dl.l.level dummy


# TODO:
# Add setting for cues for riptide + channeling
# Add Light Level 3 (Magma Blocks + standard enchants)
# Finish #3
# Add rain check to water sensitivity?


scoreboard objectives add ts.dl.mess.welc dummy
scoreboard objectives add ts.dl.mess.how trigger
scoreboard objectives add ts.dl.settings dummy


# defaults
execute unless score $enable_on_fire ts.dl.settings matches 0..1 run scoreboard players set $enable_on_fire ts.dl.settings 1
execute unless score $enable_glowing ts.dl.settings matches 0..1 run scoreboard players set $enable_glowing ts.dl.settings 0
execute unless score $enable_ghast ts.dl.settings matches 0..1 run scoreboard players set $enable_ghast ts.dl.settings 1
execute unless score $fire_aspect ts.dl.settings matches 0..1 run scoreboard players set $fire_aspect ts.dl.settings 1
execute unless score $riptide ts.dl.settings matches 0..1 run scoreboard players set $riptide ts.dl.settings 1
execute unless score $channeling ts.dl.settings matches 0..1 run scoreboard players set $channeling ts.dl.settings 1
execute unless score $enchanted_items ts.dl.settings matches 0..1 run scoreboard players set $enchanted_items ts.dl.settings 1
execute unless score $amethyst_trimmed ts.dl.settings matches 0..1 run scoreboard players set $amethyst_trimmed ts.dl.settings 1
execute unless score $enable_ghast ts.dl.settings matches 0..1 run scoreboard players set $enable_ghast ts.dl.settings 1

execute unless score $water_sensitive ts.dl.settings matches 0..1 run scoreboard players set $water_sensitive ts.dl.settings 1
execute unless score $enable_sound ts.dl.settings matches 0..1 run scoreboard players set $enable_sound ts.dl.settings 1


scoreboard objectives add tschipcraft.menu trigger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##by Tschipcraft

playsound block.beacon.power_select player @a ~ ~ ~ 0.3
execute if score $enable_sound ts.dl.settings matches 1 run playsound 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

playsound block.conduit.activate player @a ~ ~ ~ 0.8
execute if score $enable_sound ts.dl.settings matches 1 run playsound 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

playsound block.beacon.deactivate player @a ~ ~ ~ 0.3
execute if score $enable_sound ts.dl.settings matches 1 run playsound 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

playsound block.conduit.deactivate player @a ~ ~ ~ 0.3
execute if score $enable_sound ts.dl.settings matches 1 run playsound block.conduit.deactivate player @a ~ ~ ~ 0.3
scoreboard players set @s ts.dl.sound 0
2 changes: 1 addition & 1 deletion data/dynamiclights/functions/internal/ghast.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

execute as @s[predicate=dynamiclights:ghast_targeting] run scoreboard players add @s ts.dl.ghast_cool 1
execute as @s[predicate=!dynamiclights:ghast_targeting] run scoreboard players reset @s ts.dl.ghast_cool
execute as @s[scores={ts.dl.ghast_cool=10..20}] at @s run function dynamiclights:summon_light
execute as @s[scores={ts.dl.ghast_cool=10..20}] at @s run function dynamiclights:internal/place_light/15/summon
execute as @s[scores={ts.dl.ghast_cool=60..}] run scoreboard players reset @s ts.dl.ghast_cool
4 changes: 2 additions & 2 deletions data/dynamiclights/functions/internal/main.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
tag @e[type=minecraft:marker,tag=ts.dl.light] add ts.dl.remove

# Core
# TODO: Change $unlimited behavior
# 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

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

# Menu
function dynamiclights:menu
function dynamiclights:internal/menu

# Repeat
schedule function dynamiclights:internal/main 1t
10 changes: 5 additions & 5 deletions data/dynamiclights/functions/internal/main_exec.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## In water?
scoreboard players add @s ts.dl.in_water 0
execute 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}] anchored eyes positioned ^ ^ ^ unless predicate dynamiclights:in_water run function dynamiclights:internal/water/exit
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
Expand All @@ -16,13 +17,12 @@ execute as @s[scores={ts.dl.sound=2},predicate=!dynamiclights:entity/has_channel
## 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
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:summon_redstone_light
execute as @s[type=minecraft:wither_skeleton,tag=ts.mm.magma_2] at @s run function dynamiclights:summon_soul_light
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 @@ -4,7 +4,6 @@
scoreboard players enable @a tschipcraft.menu
#scoreboard players add @a ts.dl.mess.welcome 0 - don't show menu on first boot
execute as @a[scores={tschipcraft.menu=1..}] run scoreboard players set @s ts.dl.mess.welc 0
execute as @a[scores={ts.dl.mess.welc=0}] run function dynamiclights:messages/welcome
execute as @a[scores={ts.dl.mess.how=1}] run function dynamiclights:messages/how_to_use
execute as @a[scores={ts.dl.mess.welc=0}] run function dynamiclights:internal/messages/welcome

execute as @a[scores={tschipcraft.menu=1..}] run schedule function dynamiclights:menu_reset 1t
execute as @a[scores={tschipcraft.menu=1..}] run schedule function dynamiclights:internal/menu_reset 1t
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## by Tschipcraft

tellraw @s ["",{"text":"➤ Dynamic Lights ${version} by Tschipcraft installed!","italic":false,"color":"green"},{"text":"\n"},{"text":"[Settings]","color":"aqua","clickEvent":{"action":"run_command","value":"/function dynamiclights:settings"},"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=${version}"},"hoverEvent":{"action":"show_text","contents":"Click here to check for updates."}}]
scoreboard players set @s ts.dl.mess.welc 1
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
##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 ts_version matches 3700.. 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"}]
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 3700.. 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.dl.version matches 2976..3106 run say 1.19 detected!
#execute if score $global ts.dl.version matches 2731..2975 run say 1.18 detected!
#execute if score $global ts.dl.version matches 2587..2730 run say 1.17 detected!
execute if score $global ts.dl.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.dl.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.dl.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.dl.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:internal/version_checker/retry

scoreboard objectives remove ts_version
execute unless score $global ts.dl.version matches 1.. run function dynamiclights:internal/version_checker/retry
4 changes: 2 additions & 2 deletions data/dynamiclights/functions/internal/water/enter.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Any entity that is in water will run this function

# Test if a sound should be played
execute unless predicate dynamiclights:entity/water_check/no_water_immersion_illuminate_items run playsound block.beacon.activate player @a ~ ~ ~ 0.3
execute unless predicate dynamiclights:entity/water_check/no_water_immersion_extinguish_items run playsound block.fire.extinguish player @a ~ ~ ~ 0.3
execute if score $enable_sound ts.dl.settings matches 1 unless predicate dynamiclights:entity/water_check/no_water_immersion_illuminate_items run playsound block.beacon.activate player @a ~ ~ ~ 0.3
execute if score $enable_sound ts.dl.settings matches 1 unless predicate dynamiclights:entity/water_check/no_water_immersion_extinguish_items run playsound block.fire.extinguish player @a ~ ~ ~ 0.3

scoreboard players set @s ts.dl.in_water 1
Loading

0 comments on commit a641620

Please sign in to comment.