Skip to content

Commit 37dfa31

Browse files
feat(api): Add option for array input in maths functions
1 parent fd4c773 commit 37dfa31

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

Diff for: data/mcanim/functions/maths/quaternion_to_xyz/calculate.mcfunction

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
execute store result score .x mcanim.maths.quaternion_to_xyz run data get storage mcanim:api/maths/quaternion_to_xyz target[0] 100
2-
execute store result score .y mcanim.maths.quaternion_to_xyz run data get storage mcanim:api/maths/quaternion_to_xyz target[1] 100
3-
execute store result score .z mcanim.maths.quaternion_to_xyz run data get storage mcanim:api/maths/quaternion_to_xyz target[2] 100
1+
execute store result score .x mcanim.maths.quaternion_to_xyz run data get storage mcanim:maths/quaternion_to_xyz target.x 100
2+
execute store result score .y mcanim.maths.quaternion_to_xyz run data get storage mcanim:maths/quaternion_to_xyz target.y 100
3+
execute store result score .z mcanim.maths.quaternion_to_xyz run data get storage mcanim:maths/quaternion_to_xyz target.z 100
44

55
scoreboard players operation .x mcanim.maths.quaternion_to_xyz *= .x mcanim.maths.quaternion_to_xyz
66
scoreboard players operation .y mcanim.maths.quaternion_to_xyz *= .y mcanim.maths.quaternion_to_xyz
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
execute unless data storage mcanim:api/maths/quaternion_to_xyz target[] run data modify storage mcanim:maths/quaternion_to_xyz target set from storage mcanim:api/maths/quaternion_to_xyz target
2+
execute unless data storage mcanim:api/maths/quaternion_to_xyz target[] run return -1
3+
4+
data modify storage mcanim:maths/quaternion_to_xyz target set value {x: 0, y: 0, z: 0, w: 0}
5+
data modify storage mcanim:maths/quaternion_to_xyz target.x set from storage mcanim:api/maths/quaternion_to_xyz target[0]
6+
data modify storage mcanim:maths/quaternion_to_xyz target.y set from storage mcanim:api/maths/quaternion_to_xyz target[1]
7+
data modify storage mcanim:maths/quaternion_to_xyz target.z set from storage mcanim:api/maths/quaternion_to_xyz target[2]
8+
data modify storage mcanim:maths/quaternion_to_xyz target.w set from storage mcanim:api/maths/quaternion_to_xyz target[3]

Diff for: data/mcanim/functions/maths/quaternion_to_xyz/init.mcfunction

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
function mcanim:maths/quaternion_to_xyz/format_input
2+
13
function mcanim:maths/quaternion_to_xyz/calculate
24

35
function mcanim:maths/quaternion_to_xyz/set_output

Diff for: data/mcanim/functions/maths/xyz_to_quaternion/calculate.mcfunction

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
scoreboard players set .w mcanim.maths.xyz_to_quaternion 100
22

3-
execute store result score .in mcanim.utils.maths run data get storage mcanim:api/maths/xyz_to_quaternion target.x 100
3+
execute store result score .in mcanim.utils.maths run data get storage mcanim:maths/xyz_to_quaternion target.x 100
44

55
function mcanim:maths/xyz_to_quaternion/calculation/transform
66

77
scoreboard players operation .x mcanim.maths.xyz_to_quaternion = .out mcanim.utils.maths
88

99

10-
execute store result score .in mcanim.utils.maths run data get storage mcanim:api/maths/xyz_to_quaternion target.y 100
10+
execute store result score .in mcanim.utils.maths run data get storage mcanim:maths/xyz_to_quaternion target.y 100
1111

1212
function mcanim:maths/xyz_to_quaternion/calculation/transform
1313

1414
scoreboard players operation .y mcanim.maths.xyz_to_quaternion = .out mcanim.utils.maths
1515

1616

17-
execute store result score .in mcanim.utils.maths run data get storage mcanim:api/maths/xyz_to_quaternion target.z 100
17+
execute store result score .in mcanim.utils.maths run data get storage mcanim:maths/xyz_to_quaternion target.z 100
1818

1919
function mcanim:maths/xyz_to_quaternion/calculation/transform
2020

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
execute unless data storage mcanim:api/maths/xyz_to_quaternion target[] run data modify storage mcanim:maths/xyz_to_quaternion target set from storage mcanim:api/maths/xyz_to_quaternion target
2+
execute unless data storage mcanim:api/maths/xyz_to_quaternion target[] run return -1
3+
4+
data modify storage mcanim:maths/xyz_to_quaternion target set value {x: 0, y: 0, z: 0}
5+
data modify storage mcanim:maths/xyz_to_quaternion target.x set from storage mcanim:api/maths/xyz_to_quaternion target[0]
6+
data modify storage mcanim:maths/xyz_to_quaternion target.y set from storage mcanim:api/maths/xyz_to_quaternion target[1]
7+
data modify storage mcanim:maths/xyz_to_quaternion target.z set from storage mcanim:api/maths/xyz_to_quaternion target[2]

Diff for: data/mcanim/functions/maths/xyz_to_quaternion/init.mcfunction

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
function mcanim:maths/xyz_to_quaternion/format_input
2+
13
function mcanim:maths/xyz_to_quaternion/calculate
24

35
function mcanim:maths/xyz_to_quaternion/set_output

0 commit comments

Comments
 (0)