Skip to content

Commit

Permalink
Merge pull request #32 from Tschipcraft/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschipcraft authored May 24, 2024
2 parents 0983d58 + 4053f45 commit b2f74a9
Show file tree
Hide file tree
Showing 252 changed files with 5,260 additions and 256 deletions.
51 changes: 31 additions & 20 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ on:
mc_version_range:
description: 'Minecraft version(s) the data pack runs in (encoded in version range spec)'
required: true
default: '[1.17,1.20.4]'
default: '>=1.17 <=1.20.4'

jobs:
build:
deploy:
runs-on: ubuntu-latest
name: Build and publish project
steps:
- name: Checkout code
uses: actions/[email protected]
uses: actions/checkout@v4
with:
show-progress: false
- name: Extract tag
id: tag_version
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
Expand All @@ -39,21 +42,27 @@ jobs:
find: "${version}"
replace: ${{ github.event.inputs.tag }}
regex: false
- name: Find and replace supported mc versions
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${mc_version}"
replace: ${{ github.event.inputs.mc_version }}
regex: false

# Check for existence of datapack, mod and/or resourcepack folders.
- name: Check for data folder
id: check_datapack_folder
uses: andstor/file-existence-action@v2
uses: andstor/file-existence-action@v3
with:
files: "data"
- name: Check for mod folders
id: check_mod_folder
uses: andstor/file-existence-action@v2
uses: andstor/file-existence-action@v3
with:
files: "META-INF, net, fabric.mod.json, assets"
- name: Check for resource pack folder
id: check_assets_folder
uses: andstor/file-existence-action@v2
uses: andstor/file-existence-action@v3
with:
files: "assets/minecraft"

Expand All @@ -75,20 +84,6 @@ jobs:
args: zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-resourcepack.zip" -r assets pack.mcmeta pack.png LICENSE README.md

# Upload
- name: Upload outputs to GitHub releases
uses: Kir-Antipov/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-tag: v${{ github.event.inputs.tag }}
game-versions: ${{ github.event.inputs.mc_version_range }}

name: Release v${{ github.event.inputs.tag }}
version: v${{ github.event.inputs.tag }}
changelog-file: CHANGELOG.*

files: |
./${{ github.event.repository.name }}-*.@(zip|jar)
- name: Upload data pack version to Modrinth
uses: Kir-Antipov/[email protected]
if: steps.check_datapack_folder.outputs.files_exists == 'true'
Expand Down Expand Up @@ -174,3 +169,19 @@ jobs:
quilt
files: |
./${{ github.event.repository.name }}-*-mod.jar
- name: Add changelog header for GitHub release
run: sed -i '1i_Changelog:_' CHANGELOG.md
- name: Upload outputs to GitHub releases
uses: Kir-Antipov/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-tag: v${{ github.event.inputs.tag }}
game-versions: ${{ github.event.inputs.mc_version_range }}

name: Release v${{ github.event.inputs.tag }}
version: v${{ github.event.inputs.tag }}
changelog-file: CHANGELOG.md

files: |
./${{ github.event.repository.name }}-*.@(zip|jar)
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
37 changes: 31 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
- **Update to Minecraft 1.20.4** 🦇
- **Improved performance of light placement checks**
- Moved dynamic light spawn location to eye level
- Added global function api calls for placing dynamic lights
- Added a check before removing light markers to make sure the light block itself got removed first
- Added interaction entities to the ignore tag list
- **Update to Minecraft 1.20.6 🐺**
These changes utilize overlays to maintain backwards compatibility
- Switched to testing components rather than NBT in predicates
- Added support for the newly added contents slot in predicates
- **Added intermediate light levels 3 and 12** ([#14](https://github.com/Tschipcraft/dynamiclights/issues/14))
- Magma cubes, magma blocks, magma cream, all remaining amethyst buds, heart of the sea and totem of undying (closes [#23](https://github.com/Tschipcraft/dynamiclights/issues/23)) now emit light level 3
- Dragon fireballs now emit light level 12 instead of 15
- **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))
- **Added support for parsing item displays, block displays and falling blocks**
- **Added support for parsing tridents, arrows and ominous item spawners in versions 1.20.5 and up**
- Simplified light block placement and removal
- Fixed shulkers teleporting away when shooting (closes [#20](https://github.com/Tschipcraft/dynamiclights/issues/20))
- Eventified item frame reparsing in versions before 1.20.5
Item frame reparsing is now triggered when a player right-clicks on an item frame or when an item drops nearby in versions prior to 24w11a
This should improve performance in regions with a high number of item frames while also improving responsiveness (first steps for [#13](https://github.com/Tschipcraft/dynamiclights/issues/13))
- Improved dynamic light explosion avoidance performance by checking a global score instead of scanning for nearby area effect clouds
- Fixed dynamic lights overwriting cave_air with air
- Fixed dynamic light position offset for item entities
- Added separate mod support tag lists for modded items
- Added additional overlay that should slightly improve performance when placing dynamic lights in 1.20.2 and above
- Gave dynamic light marker entities a custom name ([#19](https://github.com/Tschipcraft/dynamiclights/issues/19))
- Some light level changes
- Added conduit to light level 15 items
- Moved glowstone dust from light level 15 to light level 9
- Added crying obsidian to light level 9 items
- Added small_fireball to light level 9 entities
- Moved allay from 9 to light level 6 entities
- Added enchanted golden apple, enchanting table, enchanted book, sculk catalyst and the upcoming vault to light level 6 items
- Added paintings to the ignore tag list
- Added tnt minecarts to the may_block_explosion_damage tag list
4 changes: 2 additions & 2 deletions META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ version="${version}+mod"
displayName="Dynamic Lights"
description='''Supported entities and items will emit light by using the light block added in 21w13a.
§lSupported Items:§r 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
§lSupported Items:§r Torches, Lanterns, Campfires, Glowstone, Glowstone Dust, Magma Blocks, Blaze Rods, Blaze Powder, Spectral Arrows, Lava Buckets, Sea Lanterns, Prismarine Crystals, Sea Pickles, Froglights, Glow Ink Sacs, Glow Berries, Glow Item Frames, Glow Lichen, Sculk Catalysts, Vaults, Jack o'Lanterns, Shroomlights, End Rods, End Crystals, Fire Charge, Amethyst Shards, Crying Obsidian, Nether Stars, Totems, Ender Chests, Enchanting Tables and Beacons
Additionally, all enchanted items will emit light level 6 while Fire Aspect, Riptide or Channeling enchanted items emit light level 9.
§lSupported Entities:§r Allays, Glow Squids, Glow Item Frames, Blazes, TNT, End Crystals, Fireballs, Spectral Arrows, Shulker Bullets, Firework Rockets and Flying Wither Skulls
§lSupported Entities:§r Allays, Glow Squids, Glow Item Frames, Blazes, TNT, End Crystals, Fireballs, Spectral Arrows, Shulker Bullets, Magma Cubes, Firework Rockets and Flying Wither Skulls
This mod is completely server-side!
Expand Down
15 changes: 8 additions & 7 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 @@ -28,7 +28,8 @@ Additionally, all enchanted items will emit light level 6 while Fire Aspect, Rip

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

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)

Expand All @@ -37,7 +38,7 @@ This data pack/mod is completely server-side! No Optifine required!

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
20 changes: 20 additions & 0 deletions data/dynamiclights/advancements/interacted_with_item_frame.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"criteria": {
"player_interacted": {
"trigger": "minecraft:player_interacted_with_entity",
"conditions": {
"entity": {
"type": "#dynamiclights:reparse_interactible"
}
}
}
},
"requirements": [
[
"player_interacted"
]
],
"rewards": {
"function": "dynamiclights:internal/item_frame/interacted"
}
}
7 changes: 7 additions & 0 deletions data/dynamiclights/functions/api/place_light/12.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
##by Tschipcraft
# Places a dynamic light block with light level 12 near the provided location (~ ~ ~) that will disappear after 1 tick
# Additionally sets the score #check_passed ts.dl.temp to 1

scoreboard players set #check_passed ts.dl.temp 1

function dynamiclights:internal/place_light/12/exec
4 changes: 3 additions & 1 deletion data/dynamiclights/functions/api/place_light/15.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
# Places a dynamic light block with light level 15 near the provided location (~ ~ ~) that will disappear after 1 tick
# Additionally sets the score #check_passed ts.dl.temp to 1

function dynamiclights:internal/place_light/15/summon
scoreboard players set #check_passed ts.dl.temp 1

function dynamiclights:internal/place_light/15/exec
7 changes: 7 additions & 0 deletions data/dynamiclights/functions/api/place_light/3.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
##by Tschipcraft
# Places a dynamic light block with light level 3 near the provided location (~ ~ ~) that will disappear after 1 tick
# Additionally sets the score #check_passed ts.dl.temp to 1

scoreboard players set #check_passed ts.dl.temp 1

function dynamiclights:internal/place_light/3/exec
4 changes: 3 additions & 1 deletion data/dynamiclights/functions/api/place_light/6.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
# Places a dynamic light block with light level 6 near the provided location (~ ~ ~) that will disappear after 1 tick
# Additionally sets the score #check_passed ts.dl.temp to 1

function dynamiclights:internal/place_light/6/summon
scoreboard players set #check_passed ts.dl.temp 1

function dynamiclights:internal/place_light/6/exec
4 changes: 3 additions & 1 deletion data/dynamiclights/functions/api/place_light/9.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
# Places a dynamic light block with light level 9 near the provided location (~ ~ ~) that will disappear after 1 tick
# Additionally sets the score #check_passed ts.dl.temp to 1

function dynamiclights:internal/place_light/9/summon
scoreboard players set #check_passed ts.dl.temp 1

function dynamiclights:internal/place_light/9/exec
4 changes: 4 additions & 0 deletions data/dynamiclights/functions/install.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scoreboard objectives add ts.dl.in_water dummy
scoreboard objectives add ts.dl.in_rain dummy
scoreboard objectives add ts.dl.sound dummy
scoreboard objectives add ts.dl.tnt.fuse dummy
scoreboard objectives add ts.dl.shulker dummy

# Item score specification
# Type:
Expand Down Expand Up @@ -66,6 +67,9 @@ scoreboard objectives add tvc_ignore dummy
# 17 for v1.7
scoreboard players set dynamiclights load.status 17

# Reset advancement
advancement revoke @a only dynamiclights:interacted_with_item_frame

## Schedule functions
schedule function dynamiclights:internal/main 5t
schedule function dynamiclights:internal/loop 4t
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
@@ -0,0 +1,4 @@
##by Tschipcraft
# Resets the global explosion alarm

scoreboard players reset $global ts.dl.tnt.fuse
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,5 @@ execute as @s[tag=!ts.dl.tnt.setup] run function dynamiclights:internal/explosio

# Decrement fuse and trigger if it hits 0
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 score @s ts.dl.tnt.fuse matches ..1 run scoreboard players set $global ts.dl.tnt.fuse 1
execute if score @s ts.dl.tnt.fuse matches ..1 run schedule function dynamiclights:internal/explosion_detection/reset 1t
Loading

0 comments on commit b2f74a9

Please sign in to comment.