From eaa623c4138c4310ab33f81dfd84a99e6664faed Mon Sep 17 00:00:00 2001 From: themodernhakr Date: Mon, 24 Mar 2025 14:10:08 -0500 Subject: [PATCH] vault backup: 2025-03-24 14:10:08 --- .obsidian/workspace.json | 2 +- .../When Two Macros are Faster than One.md | 46 +++++++++++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index cea03cc..4885493 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -14,7 +14,7 @@ "type": "markdown", "state": { "file": "Minecraft Datapacking/When Two Macros are Faster than One.md", - "mode": "source", + "mode": "preview", "source": false }, "icon": "lucide-file", diff --git a/Minecraft Datapacking/When Two Macros are Faster than One.md b/Minecraft Datapacking/When Two Macros are Faster than One.md index 094fa87..b23690a 100644 --- a/Minecraft Datapacking/When Two Macros are Faster than One.md +++ b/Minecraft Datapacking/When Two Macros are Faster than One.md @@ -5,31 +5,49 @@ published: "true" While working on my Database datapack (still WIP), I knew I'd want to find # One Macro -```mcfunction -data modify storage ferdinland:ferdinland temp.keyword set value 'entry500' +```ts +// one_macro/run.mcfunction -function ferdinland:database/benchmark/arraytest3/_searcharray with storage ferdinland:ferdinland temp +data modify storage test_namespace:test_namespace temp.keyword set value 'entry500' -data remove storage ferdinland:ferdinland temp.keyword +function test_namespace:one_macro/_searcharray with storage test_namespace:test_namespace temp -data remove storage ferdinland:ferdinland temp.result +data remove storage test_namespace:test_namespace temp.keyword + +data remove storage test_namespace:test_namespace temp.result ``` -``` -$data modify storage ferdinland:ferdinland temp.result set from storage`` ferdinland:ferdinland database.test.arrayTest3.array[string:$(keyword)] +```ts +// one_macro/_searcharray.mcfunction + +$data modify storage test_namespace:test_namespace temp.result set from storage`` test_namespace:test_namespace database.test.arrayTest3.array[string:$(keyword)] ``` # Two Macro -```mcfunction -data modify storage ferdinland:ferdinland temp.keyword set value 'entry500' +```ts +// two_macro/run.mcfunction -function ferdinland:database/benchmark/arraytest2/_searchindex with storage ferdinland:ferdinland temp +data modify storage test_namespace:test_namespace temp.keyword set value 'entry500' -function ferdinland:database/benchmark/arraytest2/_searcharray with storage ferdinland:ferdinland temp +function test_namespace:two_macro/_searchindex with storage test_namespace:test_namespace temp -data remove storage ferdinland:ferdinland temp.keyword +function test_namespace:two_macro/_searcharray with storage test_namespace:test_namespace temp -data remove storage ferdinland:ferdinland temp.index +data remove storage test_namespace:test_namespace temp.keyword -data remove storage ferdinland:ferdinland temp.result +data remove storage test_namespace:test_namespace temp.index + +data remove storage test_namespace:test_namespace temp.result +``` + +```ts +// two_macro/_searchindex.mcfunction + +$data modify storage test_namespace:test_namespace temp.index set from storage test_namespace:test_namespace database.test.arrayTest2.index.$(keyword) +``` + +```ts +// two_macro/_searcharray.mcfunction + +$data modify storage test_namespace:test_namespace temp.result set from storage test_namespace:test_namespace database.test.arrayTest2.array[$(index)] ``` \ No newline at end of file