Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'

on:
push:
branches: [main, devlop]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Download on Modrinth](https://img.shields.io/badge/Download%20on-Modrinth-00AF5C?style=for-the-badge&logo=modrinth&logoColor=white)](https://modrinth.com/datapack/datalib)

---
> Current version: **v6.0.1-pre2**
> Current version: **v6.0.1**
---

> [!WARNING]
Expand All @@ -21,7 +21,7 @@
---

> [!NOTE]
> **v6.0.1-pre2:** the stage-0 load entry point was renamed `dl_load:_` → `dl_load:main`, the marker-entity + `say` broadcast pattern was replaced everywhere with `tellraw` (using the current `click_event`/`command` button format — the old `clickEvent`/`value` field names were renamed by Mojang as of 1.21.5), and the load pipeline was split into `dl_load:resolve/*` (version + dependency resolution) and `dl_load:loader/*` (scoreboard/storage initialization).
> **v6.0.1:** the stage-0 load entry point was renamed `dl_load:_` → `dl_load:main`, the marker-entity + `say` broadcast pattern was replaced everywhere with `tellraw` (using the current `click_event`/`command` button format — the old `clickEvent`/`value` field names were renamed by Mojang as of 1.21.5), and the load pipeline was split into `dl_load:resolve/*` (version + dependency resolution) and `dl_load:loader/*` (scoreboard/storage initialization).
---
> 🛡️ **This is a Minecraft Datapack — it contains no executables or scripts outside of `.mcfunction` files.**
> Some antivirus software may flag `.mcfunction` files as suspicious due to macro-like syntax. This is a **false positive**. The pack has been scanned on [VirusTotal](https://www.virustotal.com) and returned clean.
Expand Down Expand Up @@ -58,7 +58,7 @@ data modify storage <namespace>:engine loaded_datalib set value 1b
```
datalib:engine (persistent data)
├── global
│ ├── version: "v6.0.1-pre2"
│ ├── version: "v6.0.1"
│ └── tick: <int>
├── players
│ └── Steve { coins:150, level:5, xp:2300, online:1b, ... }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"trigger": {
"trigger": "minecraft:fishing_rod_hooked",
"conditions": {
"entity": {
"type": "minecraft:entity_properties",
"entity": "this",
"predicate": {}
}
"entity": [
{
"entity": "this",
"predicate": {},
"condition": "minecraft:entity_properties"
}
]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
"interact_anvil": {
"trigger": "minecraft:default_block_use",
"conditions": {
"location": {
"type": "minecraft:location_check",
"location": [
{
"predicate": {
"block": {
"blocks": [
"minecraft:anvil"
]
}
}
},
"condition": "minecraft:location_check"
}
}
]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"interact_shulker_box": {
"trigger": "minecraft:default_block_use",
"conditions": {
"location": {
"type": "minecraft:location_check",
"location": [
{
"predicate": {
"block": {
"blocks": [
Expand All @@ -26,9 +26,11 @@
"minecraft:red_shulker_box",
"minecraft:black_shulker_box"
]
}
}
},
"condition": "minecraft:location_check"
}
}
]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"conditions": {
"killing_blow": {
"direct_entity": {
"minecraft:entity_type": "minecraft:arrow"
"entity_type": "minecraft:arrow"
}
}
}
Expand All @@ -15,4 +15,4 @@
"function": "datalib:systems/hook/on_killed_by_arrow"
},
"parent": "datalib:hidden/root"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
# function datalib:core/tick/resume
# function datalib:core/tick/status
# function datalib:core/tick/reset_channels
# function datalib:systems/log/testblock/place — (re)place the mode=log
# test_block at datalib:engine debug_log_pos
# function datalib:debug/tools/log/enable — mirror log messages to
# latest.log via the test_block (default: off)
# function datalib:debug/tools/log/disable — turn that mirroring back off
# ─────────────────────────────────────────────────────────────────────────────

data modify storage datalib:engine tick.channels set value []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# datalib:debug/tools/log/disable
# Turns off test_block console mirroring for systems/log/add calls.
# Verify it took effect with: /data get storage datalib:engine security.debug_log
data modify storage datalib:engine security.debug_log set value 0b
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# datalib:debug/tools/log/enable
# Turns on test_block console mirroring for systems/log/add calls.
# Requires the test_block to already be placed — run
# /function datalib:systems/log/testblock/place first if you haven't.
# Verify it took effect with: /data get storage datalib:engine security.debug_log
data modify storage datalib:engine security.debug_log set value 1b
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ $data modify storage datalib:engine log_display append value {text:"[$(level)] $
scoreboard players add #dl.log_count dl.tmp 1
execute if score #dl.log_count dl.tmp matches 31.. run data remove storage datalib:engine log_display[0]
execute if score #dl.log_count dl.tmp matches 31.. run scoreboard players remove #dl.log_count dl.tmp 1

# Optional console mirroring via test_block (off by default — enable with
# /function datalib:debug/tools/log/enable). No tellraw, no chat spam:
# this only touches a block's NBT + power state, which is what makes the
# game write the message line into latest.log.
$execute if data storage datalib:engine security{debug_log:1b} run function datalib:systems/log/testblock/pulse {message:"[$(level)] $(message)"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# datalib:systems/log/testblock/place
# Places (or re-places) the mode=log test_block at datalib:engine
# debug_log_pos. Run this once after changing debug_log_pos, or if the
# block is ever broken/removed by world edits.
#
# NOTE: placing/editing a test_block requires operator permission
# (level 2+) — this is a vanilla restriction on the block itself, not a
# limitation added by this pack.

function datalib:systems/log/testblock/place_at with storage datalib:engine debug_log_pos
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# datalib:systems/log/testblock/place_at [MACRO]
# Input: $(x), $(y), $(z) — from debug_log_pos
$setblock $(x) $(y) $(z) minecraft:test_block[mode=log]{message:"[dataLib] (idle)",mode:"log",powered:0b} replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# datalib:systems/log/testblock/pulse [MACRO]
# Writes $(message) into the test_block and powers it, which is what
# actually makes the game write the message to latest.log.
# Input: $(message) — pre-formatted log line, e.g. "[DEBUG] channel X fired"
#
# Read position fresh each call so datalib:systems/log/testblock/place
# never needs to be re-run manually after a debug_log_pos change.
# debug_log_pos already stores flat top-level x/y/z fields, so copying
# it wholesale and adding msg alongside gives pulse_at everything it
# needs via a single 'with storage' call.

data modify storage datalib:tick_work testblock set from storage datalib:engine debug_log_pos
$data modify storage datalib:tick_work testblock.msg set value "$(message)"

function datalib:systems/log/testblock/pulse_at with storage datalib:tick_work testblock

# Unpower one tick later so the block is ready to detect the next
# redstone-style "change" (mode=log logs on each power transition, not
# continuously while powered).
schedule function datalib:systems/log/testblock/unpulse_at 1t replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# datalib:systems/log/testblock/pulse_at [MACRO]
# Input: $(x), $(y), $(z), $(msg) — from the testblock compound built
# in pulse.mcfunction (debug_log_pos fields + msg alongside them).
# 'replace' keeps it a fresh block-entity each time so the message
# always actually updates (partial NBT merges on test_block can be
# unreliable across versions; a full replace is the safe, portable way).
$setblock $(x) $(y) $(z) minecraft:test_block[mode=log]{message:"$(msg)",mode:"log",powered:1b} replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# datalib:systems/log/testblock/unpulse_at
# Scheduled 1 tick after pulse_at — resets powered to 0b so the block is
# ready to detect the next power transition. Message text is left as-is
# (harmless; it's overwritten on the next pulse anyway) and read from
# the persistent debug_log_pos rather than tick_work, since tick_work
# may have been overwritten by other tick-loop activity in that 1 tick.

function datalib:systems/log/testblock/unpulse_here with storage datalib:engine debug_log_pos
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# datalib:systems/log/testblock/unpulse_here [MACRO]
# Input: $(x), $(y), $(z)
$data merge block $(x) $(y) $(z) {powered:0b}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "minecraft:set_damage",
"damage": {
"type": "minecraft:uniform",
"min": 0.1,
"max": 0.9
}
},
"function": "minecraft:set_damage"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"type": "minecraft:enchant_randomly"
"function": "minecraft:enchant_randomly"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "minecraft:enchant_with_levels",
"levels": 30
"levels": 30,
"function": "minecraft:enchant_with_levels"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "minecraft:enchant_with_levels",
"levels": 5
"levels": 5,
"function": "minecraft:enchant_with_levels"
}
4 changes: 2 additions & 2 deletions datapacks/dataLib/data/datalib/item_modifier/glint_add.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "minecraft:set_components",
"components": {
"minecraft:enchantment_glint_override": true
}
},
"function": "minecraft:set_components"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "minecraft:set_components",
"components": {
"minecraft:enchantment_glint_override": false
}
},
"function": "minecraft:set_components"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "minecraft:set_components",
"components": {
"minecraft:tooltip_display": {
"hide_tooltip": true
}
}
},
"function": "minecraft:set_components"
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"type": "minecraft:set_lore",
"lore": [
{
"storage": "datalib:input",
"nbt": "lore",
"nbt": "lore",
"interpret": true,
"separator": "\n"
}
],
"mode": "append"
"mode": "append",
"function": "minecraft:set_lore"
}
4 changes: 2 additions & 2 deletions datapacks/dataLib/data/datalib/item_modifier/lore_clear.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "minecraft:set_lore",
"lore": [],
"mode": "replace_all"
"mode": "replace_all",
"function": "minecraft:set_lore"
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"type": "minecraft:set_name",
"target": "item_name",
"name": {
"text": "Custom Item",
"italic": false,
"color": "gold"
}
},
"function": "minecraft:set_name"
}
4 changes: 2 additions & 2 deletions datapacks/dataLib/data/datalib/item_modifier/repair_full.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "minecraft:set_damage",
"damage": 0.0
"damage": 0.0,
"function": "minecraft:set_damage"
}
4 changes: 2 additions & 2 deletions datapacks/dataLib/data/datalib/item_modifier/set_count_1.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "minecraft:set_count",
"count": 1
"count": 1,
"function": "minecraft:set_count"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "minecraft:set_count",
"count": 64
"count": 64,
"function": "minecraft:set_count"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"_comment": "datalib:item_modifier/set_custom_model_data \u2014 Sets the minecraft:custom_model_data component (1.21.4+ format). Copy and edit the floats/strings/flags/colors arrays for your resource pack model overrides.",
"type": "minecraft:set_components",
"_comment": "datalib:item_modifier/set_custom_model_data — Sets the minecraft:custom_model_data component (1.21.4+ format). Copy and edit the floats/strings/flags/colors arrays for your resource pack model overrides.",
"components": {
"minecraft:custom_model_data": {
"floats": [
Expand All @@ -10,5 +9,6 @@
"strings": [],
"colors": []
}
}
},
"function": "minecraft:set_components"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "minecraft:set_enchantments",
"enchantments": {},
"add": false
"add": false,
"function": "minecraft:set_enchantments"
}
4 changes: 2 additions & 2 deletions datapacks/dataLib/data/datalib/item_modifier/unbreakable.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "minecraft:set_components",
"components": {
"minecraft:unbreakable": {}
}
},
"function": "minecraft:set_components"
}
Loading