summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-05-21 14:18:14 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-05-21 14:18:14 +0200
commita0a602653d34b831a7ffbe0cecf8a6bf3bd26016 (patch)
treeb5eb54a54b5691e3696d3f727c06e17e566e59d2 /data
initial commit
Diffstat (limited to 'data')
-rw-r--r--data/minecraft/tags/functions/load.json5
-rw-r--r--data/minecraft/tags/functions/tick.json5
-rw-r--r--data/onechunk/functions/initialize.mcfunction26
-rw-r--r--data/onechunk/functions/load.mcfunction3
-rw-r--r--data/onechunk/functions/tick.mcfunction0
5 files changed, 39 insertions, 0 deletions
diff --git a/data/minecraft/tags/functions/load.json b/data/minecraft/tags/functions/load.json
new file mode 100644
index 0000000..d72a399
--- /dev/null
+++ b/data/minecraft/tags/functions/load.json
@@ -0,0 +1,5 @@
+{
+ "values": [
+ "onechunk:load"
+ ]
+}
diff --git a/data/minecraft/tags/functions/tick.json b/data/minecraft/tags/functions/tick.json
new file mode 100644
index 0000000..dc8ca50
--- /dev/null
+++ b/data/minecraft/tags/functions/tick.json
@@ -0,0 +1,5 @@
+{
+ "values": [
+ "onechunk:tick"
+ ]
+}
diff --git a/data/onechunk/functions/initialize.mcfunction b/data/onechunk/functions/initialize.mcfunction
new file mode 100644
index 0000000..446e061
--- /dev/null
+++ b/data/onechunk/functions/initialize.mcfunction
@@ -0,0 +1,26 @@
+scoreboard players set $chunkSize onechunk_data 16
+
+execute store result score $posX onechunk_data run data get entity @p Pos[0]
+execute store result score $posZ onechunk_data run data get entity @p Pos[2]
+
+# posX - ( posX % 16 )
+# posZ - ( posZ % 16 )
+# = chunk start corner
+# + 15 = chunk end corner
+
+execute store result score $chunkStartX onechunk_data run scoreboard players get $posX onechunk_data
+execute store result score $tmp onechunk_data run scoreboard players get $posX onechunk_data
+scoreboard players operation $tmp onechunk_data %= $chunkSize onechunk_data
+scoreboard players operation $chunkStartX onechunk_data -= $tmp onechunk_data
+
+execute store result score $chunkStartZ onechunk_data run scoreboard players get $posZ onechunk_data
+execute store result score $tmp onechunk_data run scoreboard players get $posZ onechunk_data
+scoreboard players operation $tmp onechunk_data %= $chunkSize onechunk_data
+scoreboard players operation $chunkStartZ onechunk_data -= $tmp onechunk_data
+
+fill
+
+#X-1 -64 Z-1 X+15+1 319 Z-1
+#X-1 -64 Z-1 X-1 219 Z+15+1
+#X+15+1 -64 Z-1 X+15+1 219 Z+15+1
+#X-1 -64 Z+15+1 X+15+1 219 Z+15+1
diff --git a/data/onechunk/functions/load.mcfunction b/data/onechunk/functions/load.mcfunction
new file mode 100644
index 0000000..05cdd4f
--- /dev/null
+++ b/data/onechunk/functions/load.mcfunction
@@ -0,0 +1,3 @@
+scoreboard objectives add onechunk_data dummy
+
+function onechunk:initialize
diff --git a/data/onechunk/functions/tick.mcfunction b/data/onechunk/functions/tick.mcfunction
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/data/onechunk/functions/tick.mcfunction