summaryrefslogtreecommitdiff
path: root/data/onechunk/functions/initialize.mcfunction
blob: 446e061e8e2eedad44fa51c89dd3ee7295c0a559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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