Skip to content

Commit

Permalink
data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodou8593 committed Jul 16, 2023
1 parent 4a03c59 commit 8761af3
Show file tree
Hide file tree
Showing 69 changed files with 845 additions and 36 deletions.
2 changes: 2 additions & 0 deletions data/math/functions/3vec/_print.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#math:3vec/_print
tellraw @a [{"text":"(3vec) @s: ["},{"score":{"name":"@s","objective":"3vec_x"}},{"text":","},{"score":{"name":"@s","objective":"3vec_y"}},{"text":","},{"score":{"name":"@s","objective":"3vec_z"}},{"text":"]"}]
4 changes: 1 addition & 3 deletions data/math/functions/3vec/_ssprint.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#math:3vec/_ssprint
tellraw @a "---3vec---"
tellraw @a [{"text":"xyz:["},{"score":{"name":"3vec_x","objective":"int"}},{"text":","},{"score":{"name":"3vec_y","objective":"int"}},{"text":","},{"score":{"name":"3vec_z","objective":"int"}},{"text":"]"}]
tellraw @a [{"text":"rot:["},{"score":{"name":"3vec_rot0","objective":"int"}},{"text":","},{"score":{"name":"3vec_rot1","objective":"int"}},{"text":","},{"score":{"name":"3vec_l","objective":"int"}},{"text":"]"}]
tellraw @a [{"text":"(3vec) ssobj: ["},{"score":{"name":"3vec_x","objective":"int"}},{"text":","},{"score":{"name":"3vec_y","objective":"int"}},{"text":","},{"score":{"name":"3vec_z","objective":"int"}},{"text":"]"}]
9 changes: 4 additions & 5 deletions data/math/functions/_init.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ data modify storage math:io item set value {}
data modify storage math:io classify set value []
scoreboard players set classify_cnt int 0

data modify storage math:io set set value []
data modify storage math:io set_tags set value []
scoreboard players set set_cnt int 0

data modify storage math:io rand_lst set value [8593,45316,3528,4112,43,296358,12936510]
execute store result score rand_seed int run data get storage math:io rand_lst[0]

Expand Down Expand Up @@ -100,4 +96,7 @@ function math:cbox/init
function math:geom/init

#高精度模块初始化
function math:hpo/init
function math:hpo/init

#集合初始化
function math:set/init
4 changes: 2 additions & 2 deletions data/math/functions/_version.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#math:_version
# 输出数学库版本
tellraw @s {"text":"<数学库> 当前为2.0.2版本."}
scoreboard players set version int 202
tellraw @s {"text":"<数学库> 当前为2.0.3版本."}
scoreboard players set version int 203
2 changes: 2 additions & 0 deletions data/math/functions/init_overworld.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
function math:marker/_origin
#告示牌
function math:marker/_sign
#箱子
function math:marker/_chest
#世界实体
function math:marker/_math
#转发实体
Expand Down
6 changes: 6 additions & 0 deletions data/math/functions/list/_fill.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#math:list/_fill
# 输入个数<inp,int>
# 用storage math:io input填充list

scoreboard players operation sloop int = inp int
execute if score sloop int matches 1.. run function math:list/fill_sloop
12 changes: 12 additions & 0 deletions data/math/functions/list/_key.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#math:list/_key
# 转动列表
# 查找键key的值是输入的位置
# 如果没查到则<res,int>输出0

execute store result score sloop int store result score stempn int if data storage math:io list[]

scoreboard players set res int 1
execute if score sloop int matches 1.. run function math:list/key_sloop
scoreboard players operation list_phi int %= stempn int
scoreboard players add res int 1
scoreboard players operation res int %= 2 int
16 changes: 16 additions & 0 deletions data/math/functions/list/_toset.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#math:list/_toset
# 转换函数:列表->集合
# 需要传入世界实体为执行者

data modify entity @s Tags set value []

data modify storage math:io set set value []
data modify storage math:io set_tags set value []
scoreboard players set set_cnt int 0

data modify storage math:io stemp set from storage math:io list
execute store result score sloop int if data storage math:io stemp[]
execute if score sloop int matches 1.. run function math:list/set/sloop
data modify storage math:io set_tags set from entity @s Tags

data modify entity @s Tags set value ["math_marker"]
5 changes: 5 additions & 0 deletions data/math/functions/list/fill_sloop.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#math:list/fill_sloop
data modify storage math:io list append from storage math:io input
#循环迭代
scoreboard players remove sloop int 1
execute if score sloop int matches 1.. run function math:list/fill_sloop
11 changes: 11 additions & 0 deletions data/math/functions/list/key_sloop.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#math:list/key_sloop
data modify storage math:io list append from storage math:io list[0]
data remove storage math:io list[0]
scoreboard players add list_phi int 1

data modify storage math:io stemp_cmp set from storage math:io list[0].key
execute store success score res int run data modify storage math:io stemp_cmp set from storage math:io input
execute if score res int matches 0 run scoreboard players set sloop int 1
#循环迭代
scoreboard players remove sloop int 1
execute if score sloop int matches 1.. run function math:list/key_sloop
9 changes: 9 additions & 0 deletions data/math/functions/list/set/sloop.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#math:list/set/sloop
data modify block 29999984 0 8591 back_text.messages[0] set value '{"nbt":"stemp[-1]","storage":"math:io"}'
data modify entity @s Tags append from block 29999984 0 8591 back_text.messages[0]
execute store result score sstemp int if data entity @s Tags[]
execute if score sstemp int > set_cnt int run function math:list/set/success
#循环迭代
data remove storage math:io stemp[-1]
scoreboard players remove sloop int 1
execute if score sloop int matches 1.. run function math:list/set/sloop
3 changes: 3 additions & 0 deletions data/math/functions/list/set/success.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#math:list/set/success
data modify storage math:io set append from storage math:io stemp[-1]
scoreboard players add set_cnt int 1
10 changes: 10 additions & 0 deletions data/math/functions/list/test/fill.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#math:list/test/fill

tellraw @a "---list_test_fill---"
scoreboard players set list_phi int 0
data modify storage math:io list set value []

data modify storage math:io input set value {key:"hi"}
scoreboard players set inp int 5
function math:list/_fill
tellraw @a ["list: ",{"nbt":"list","storage":"math:io"}]
24 changes: 24 additions & 0 deletions data/math/functions/list/test/key.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#math:list/test/key

tellraw @a "---list_test_key---"
scoreboard players set inp int 12

function math:randstring/_pull

scoreboard players set list_phi int 0
data modify storage math:io list set value []
data modify storage math:io stemp set value {key:""}
scoreboard players operation loop int = inp int
execute if score loop int matches 1.. run function math:list/test/key_loop
tellraw @a ["list: ",{"nbt":"list","storage":"math:io"}]

data modify storage math:io input set from storage math:io list[8].key
function math:list/_key
tellraw @a ["res: ",{"score":{"name":"res","objective":"int"}}]
tellraw @a ["list: ",{"nbt":"list","storage":"math:io"}]

data modify storage math:io input set value ""
function math:list/_key
tellraw @a ["res: ",{"score":{"name":"res","objective":"int"}}]

function math:randstring/_back
7 changes: 7 additions & 0 deletions data/math/functions/list/test/key_loop.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#math:list/test/key_loop
data modify storage math:io stemp.key set from storage math:io result[0]
data modify storage math:io list append from storage math:io stemp
#循环迭代
data remove storage math:io result[0]
scoreboard players remove loop int 1
execute if score loop int matches 1.. run function math:list/test/key_loop
26 changes: 26 additions & 0 deletions data/math/functions/list/test/toset.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#math:list/test/toset

tellraw @a "---list_test_toset---"

scoreboard players set list_phi int 0
data modify storage math:io list set value []

scoreboard players set inp int 2
data modify storage math:io input set value "hello"
function math:list/_fill

scoreboard players set inp int 1
data modify storage math:io input set value "world"
function math:list/_fill

scoreboard players set inp int 3
data modify storage math:io input set value "cber"
function math:list/_fill

tellraw @a ["list: ",{"nbt":"list","storage":"math:io"}]

execute as @e[tag=math_marker,limit=1] run function math:list/_toset

tellraw @a ["set: ",{"nbt":"set","storage":"math:io"}]
tellraw @a ["set_tags: ",{"nbt":"set_tags","storage":"math:io"}]
tellraw @a ["set_cnt: ",{"score":{"name":"set_cnt","objective":"int"}}]
4 changes: 4 additions & 0 deletions data/math/functions/marker/_chest.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#math:marker/_chest
forceload add 29999984 8591 29999984 8591
setblock 29999984 0 8592 chest
item replace block 29999984 0 8592 container.0 with glass
44 changes: 22 additions & 22 deletions data/math/functions/qrot/_ex-uvw.mcfunction
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
#math:qrot/_ex-uvw
#扩展函数:根据xyzw扩展局部坐标系属性

execute store result score u1 int store result score u2 int store result score stempxw int run scoreboard players operation u0 int = qrot_x int
execute store result score u1 int store result score u2 int store result score sstempxw int run scoreboard players operation u0 int = qrot_x int
scoreboard players operation u0 int *= qrot_x int
execute store result score v2 int store result score stempyw int run scoreboard players operation v1 int = qrot_y int
execute store result score v2 int store result score sstempyw int run scoreboard players operation v1 int = qrot_y int
scoreboard players operation v1 int *= qrot_y int
execute store result score stempzw int run scoreboard players operation w2 int = qrot_z int
execute store result score sstempzw int run scoreboard players operation w2 int = qrot_z int
scoreboard players operation w2 int *= qrot_z int
scoreboard players operation stempx2 int = u0 int
scoreboard players operation stempy2 int = v1 int
scoreboard players operation stempw2 int = qrot_w int
scoreboard players operation stempw2 int *= qrot_w int
scoreboard players operation u0 int += stempw2 int
scoreboard players operation sstempx2 int = u0 int
scoreboard players operation sstempy2 int = v1 int
scoreboard players operation sstempw2 int = qrot_w int
scoreboard players operation sstempw2 int *= qrot_w int
scoreboard players operation u0 int += sstempw2 int
scoreboard players operation u0 int -= v1 int
scoreboard players operation u0 int -= w2 int
scoreboard players operation v1 int += stempw2 int
scoreboard players operation v1 int -= stempx2 int
scoreboard players operation v1 int += sstempw2 int
scoreboard players operation v1 int -= sstempx2 int
scoreboard players operation v1 int -= w2 int
scoreboard players operation w2 int += stempw2 int
scoreboard players operation w2 int -= stempx2 int
scoreboard players operation w2 int -= stempy2 int
scoreboard players operation w2 int += sstempw2 int
scoreboard players operation w2 int -= sstempx2 int
scoreboard players operation w2 int -= sstempy2 int

scoreboard players operation u0 int /= 10000 int
scoreboard players operation v1 int /= 10000 int
scoreboard players operation w2 int /= 10000 int

scoreboard players operation u1 int *= qrot_y int
scoreboard players operation v0 int = u1 int
scoreboard players operation stempzw int *= qrot_w int
scoreboard players operation u1 int += stempzw int
scoreboard players operation v0 int -= stempzw int
scoreboard players operation sstempzw int *= qrot_w int
scoreboard players operation u1 int += sstempzw int
scoreboard players operation v0 int -= sstempzw int

scoreboard players operation u1 int /= 5000 int
scoreboard players operation v0 int /= 5000 int

scoreboard players operation u2 int *= qrot_z int
scoreboard players operation w0 int = u2 int
scoreboard players operation stempyw int *= qrot_w int
scoreboard players operation u2 int -= stempyw int
scoreboard players operation w0 int += stempyw int
scoreboard players operation sstempyw int *= qrot_w int
scoreboard players operation u2 int -= sstempyw int
scoreboard players operation w0 int += sstempyw int

scoreboard players operation u2 int /= 5000 int
scoreboard players operation w0 int /= 5000 int

scoreboard players operation v2 int *= qrot_z int
scoreboard players operation w1 int = v2 int
scoreboard players operation stempxw int *= qrot_w int
scoreboard players operation v2 int += stempxw int
scoreboard players operation w1 int -= stempxw int
scoreboard players operation sstempxw int *= qrot_w int
scoreboard players operation v2 int += sstempxw int
scoreboard players operation w1 int -= sstempxw int

scoreboard players operation v2 int /= 5000 int
scoreboard players operation w1 int /= 5000 int
1 change: 1 addition & 0 deletions data/math/functions/qrot/_get.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#math:qrot/_get
scoreboard players operation qrot_v0 int = @s qrot_v0
scoreboard players operation qrot_v1 int = @s qrot_v1
scoreboard players operation qrot_v2 int = @s qrot_v2
Expand Down
4 changes: 2 additions & 2 deletions data/math/functions/qrot/_print.mcfunction
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#math:qrot/_print
tellraw @a ["(qrot)xyzw: [",{"score":{"name":"qrot_x","objective":"int"}},{"text":","},{"score":{"name":"qrot_y","objective":"int"}},{"text":","},{"score":{"name":"qrot_z","objective":"int"}},{"text":","},{"score":{"name":"qrot_w","objective":"int"}},{"text":"]"}]
#math:qrot/_zprint
tellraw @a ["(qrot)xyzw: [",{"score":{"name":"@s","objective":"qrot_x"}},{"text":","},{"score":{"name":"@s","objective":"qrot_y"}},{"text":","},{"score":{"name":"@s","objective":"qrot_z"}},{"text":","},{"score":{"name":"@s","objective":"qrot_w"}},{"text":"]"}]
2 changes: 2 additions & 0 deletions data/math/functions/qrot/_ssprint.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#math:qrot/_print
tellraw @a ["(qrot)xyzw: [",{"score":{"name":"qrot_x","objective":"int"}},{"text":","},{"score":{"name":"qrot_y","objective":"int"}},{"text":","},{"score":{"name":"qrot_z","objective":"int"}},{"text":","},{"score":{"name":"qrot_w","objective":"int"}},{"text":"]"}]
1 change: 1 addition & 0 deletions data/math/functions/qrot/_store.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#math:qrot/_store
scoreboard players operation @s qrot_v0 = qrot_v0 int
scoreboard players operation @s qrot_v1 = qrot_v1 int
scoreboard players operation @s qrot_v2 = qrot_v2 int
Expand Down
32 changes: 32 additions & 0 deletions data/math/functions/qrot/_swap.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#math:qrot/_swap
scoreboard players operation qrot_v0 int >< @s qrot_v0
scoreboard players operation qrot_v1 int >< @s qrot_v1
scoreboard players operation qrot_v2 int >< @s qrot_v2
scoreboard players operation qrot_beta int >< @s qrot_beta
scoreboard players operation qrot_cbeta int >< @s qrot_cbeta
scoreboard players operation qrot_sbeta int >< @s qrot_sbeta
scoreboard players operation qrot_i0 int >< @s qrot_i0
scoreboard players operation qrot_i1 int >< @s qrot_i1
scoreboard players operation qrot_i2 int >< @s qrot_i2
scoreboard players operation qrot_i3 int >< @s qrot_i3
scoreboard players operation qrot_j0 int >< @s qrot_j0
scoreboard players operation qrot_j1 int >< @s qrot_j1
scoreboard players operation qrot_j2 int >< @s qrot_j2
scoreboard players operation qrot_j3 int >< @s qrot_j3
scoreboard players operation qrot_alpha int >< @s qrot_alpha
scoreboard players operation x int >< @s x
scoreboard players operation y int >< @s y
scoreboard players operation z int >< @s z
scoreboard players operation u0 int >< @s u0
scoreboard players operation u1 int >< @s u1
scoreboard players operation u2 int >< @s u2
scoreboard players operation v0 int >< @s v0
scoreboard players operation v1 int >< @s v1
scoreboard players operation v2 int >< @s v2
scoreboard players operation w0 int >< @s w0
scoreboard players operation w1 int >< @s w1
scoreboard players operation w2 int >< @s w2
scoreboard players operation qrot_x int >< @s qrot_x
scoreboard players operation qrot_y int >< @s qrot_y
scoreboard players operation qrot_z int >< @s qrot_z
scoreboard players operation qrot_w int >< @s qrot_w
2 changes: 0 additions & 2 deletions data/math/functions/qrot/_zprint.mcfunction

This file was deleted.

Loading

0 comments on commit 8761af3

Please sign in to comment.