From 29513178db6308cb97fb0322df14097db2934536 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 24 Jun 2024 14:03:38 +0200 Subject: update to 1.21 and fix worldborder center call --- data/minecraft/tags/function/load.json | 5 ++++ data/minecraft/tags/functions/load.json | 5 ---- data/minecraft/tags/functions/tick.json | 5 ---- data/onechunk/function/initialize.mcfunction | 40 +++++++++++++++++++++++++ data/onechunk/function/load.mcfunction | 3 ++ data/onechunk/functions/initialize.mcfunction | 43 --------------------------- data/onechunk/functions/load.mcfunction | 3 -- data/onechunk/functions/tick.mcfunction | 0 8 files changed, 48 insertions(+), 56 deletions(-) create mode 100644 data/minecraft/tags/function/load.json delete mode 100644 data/minecraft/tags/functions/load.json delete mode 100644 data/minecraft/tags/functions/tick.json create mode 100644 data/onechunk/function/initialize.mcfunction create mode 100644 data/onechunk/function/load.mcfunction delete mode 100644 data/onechunk/functions/initialize.mcfunction delete mode 100644 data/onechunk/functions/load.mcfunction delete mode 100644 data/onechunk/functions/tick.mcfunction (limited to 'data') diff --git a/data/minecraft/tags/function/load.json b/data/minecraft/tags/function/load.json new file mode 100644 index 0000000..d72a399 --- /dev/null +++ b/data/minecraft/tags/function/load.json @@ -0,0 +1,5 @@ +{ + "values": [ + "onechunk:load" + ] +} diff --git a/data/minecraft/tags/functions/load.json b/data/minecraft/tags/functions/load.json deleted file mode 100644 index d72a399..0000000 --- a/data/minecraft/tags/functions/load.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "onechunk:load" - ] -} diff --git a/data/minecraft/tags/functions/tick.json b/data/minecraft/tags/functions/tick.json deleted file mode 100644 index dc8ca50..0000000 --- a/data/minecraft/tags/functions/tick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "onechunk:tick" - ] -} diff --git a/data/onechunk/function/initialize.mcfunction b/data/onechunk/function/initialize.mcfunction new file mode 100644 index 0000000..4d545a0 --- /dev/null +++ b/data/onechunk/function/initialize.mcfunction @@ -0,0 +1,40 @@ +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 + +execute store result score $chunkCenterX onechunk_data run scoreboard players get $chunkStartX onechunk_data +scoreboard players set $tmp onechunk_data 8 +scoreboard players operation $chunkCenterX onechunk_data += $tmp onechunk_data + +execute store result score $chunkCenterZ onechunk_data run scoreboard players get $chunkStartZ onechunk_data +scoreboard players set $tmp onechunk_data 8 +scoreboard players operation $chunkCenterZ onechunk_data += $tmp onechunk_data + +summon armor_stand ~ ~ ~ {NoGravity:1,Invulnerable:1,Invisible:1,Tags:["onechunk_chunk_center"]} +execute store result entity @e[tag=onechunk_chunk_center,limit=1] Pos[0] double 1 run scoreboard players get $chunkCenterX onechunk_data +execute store result entity @e[tag=onechunk_chunk_center,limit=1] Pos[2] double 1 run scoreboard players get $chunkCenterZ onechunk_data +execute store result entity @e[tag=onechunk_chunk_center,limit=1] Pos[1] double 1 run data get entity @p Pos[1] + +execute at @e[tag=onechunk_chunk_center,limit=1] run worldborder center ~ ~ +kill @e[tag=onechunk_chunk_center] + +# TODO: how to set to score? +worldborder set 16 + +scoreboard players set $initialized onechunk_data 1 diff --git a/data/onechunk/function/load.mcfunction b/data/onechunk/function/load.mcfunction new file mode 100644 index 0000000..bda726f --- /dev/null +++ b/data/onechunk/function/load.mcfunction @@ -0,0 +1,3 @@ +scoreboard objectives add onechunk_data dummy + +execute unless score $initialized onechunk_data matches 1 run function onechunk:initialize diff --git a/data/onechunk/functions/initialize.mcfunction b/data/onechunk/functions/initialize.mcfunction deleted file mode 100644 index 5d6766c..0000000 --- a/data/onechunk/functions/initialize.mcfunction +++ /dev/null @@ -1,43 +0,0 @@ -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 - -execute store result score $chunkCenterX onechunk_data run scoreboard players get $chunkStartX onechunk_data -scoreboard players set $tmp onechunk_data 8 -scoreboard players operation $chunkCenterX onechunk_data += $tmp onechunk_data - -execute store result score $chunkCenterZ onechunk_data run scoreboard players get $chunkStartZ onechunk_data -scoreboard players set $tmp onechunk_data 8 -scoreboard players operation $chunkCenterZ onechunk_data += $tmp onechunk_data - -summon armor_stand ~ ~ ~ {NoGravity:1,Invulnerable:1,Invisible:1,Tags:["teleport_target"]} -execute store result entity @e[tag=teleport_target,limit=1] Pos[0] double 1 run scoreboard players get $chunkCenterX onechunk_data -execute store result entity @e[tag=teleport_target,limit=1] Pos[2] double 1 run scoreboard players get $chunkCenterZ onechunk_data -execute store result entity @e[tag=teleport_target,limit=1] Pos[1] double 1 run data get entity @p Pos[1] - -tp @p @e[tag=teleport_target,limit=1] -kill @e[tag=teleport_target] -execute as @p run worldborder center ~ ~ -worldborder set 16 - -#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 deleted file mode 100644 index 336a971..0000000 --- a/data/onechunk/functions/load.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -scoreboard objectives add onechunk_data dummy - -#function onechunk:initialize diff --git a/data/onechunk/functions/tick.mcfunction b/data/onechunk/functions/tick.mcfunction deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3