Skip to content

Commit

Permalink
perf upd
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodou8593 committed Jul 4, 2023
1 parent b2f2802 commit f42b3d8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
21 changes: 11 additions & 10 deletions data/rot_aj/functions/check_bones.mcfunction
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#rot_aj:check_bones
execute unless data entity @s transformation{left_rotation:[0.0f,0.0f,0.0f,0.0f]} run function rot_aj:set_bones
data modify storage math:io cmp set from entity @s transformation
execute unless data storage math:io cmp{left_rotation:[0.0f,0.0f,0.0f,0.0f]} run function rot_aj:set_bones

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
execute as @e[tag=math_marker,limit=1] run function math:qrot/_mult
execute store result entity @s transformation.left_rotation[0] float 0.0001 run scoreboard players get qrot_x int
execute store result entity @s transformation.left_rotation[1] float 0.0001 run scoreboard players get qrot_y int
execute store result entity @s transformation.left_rotation[2] float 0.0001 run scoreboard players get qrot_z int
execute store result entity @s transformation.left_rotation[3] float 0.0001 run scoreboard players get qrot_w int
execute store result storage math:io cmp.left_rotation[0] float 0.0001 run scoreboard players get qrot_x int
execute store result storage math:io cmp.left_rotation[1] float 0.0001 run scoreboard players get qrot_y int
execute store result storage math:io cmp.left_rotation[2] float 0.0001 run scoreboard players get qrot_z int
execute store result storage math:io cmp.left_rotation[3] float 0.0001 run scoreboard players get qrot_w int
scoreboard players operation u int = @s x
scoreboard players operation v int = @s y
scoreboard players operation w int = @s z
function math:uvw/_tofvec
execute store result entity @s transformation.translation[0] float 0.0001 run scoreboard players get 3vec_x int
execute store result entity @s transformation.translation[1] float 0.0001 run scoreboard players get 3vec_y int
execute store result entity @s transformation.translation[2] float 0.0001 run scoreboard players get 3vec_z int
execute store result storage math:io cmp.translation[0] float 0.0001 run scoreboard players get 3vec_x int
execute store result storage math:io cmp.translation[1] float 0.0001 run scoreboard players get 3vec_y int
execute store result storage math:io cmp.translation[2] float 0.0001 run scoreboard players get 3vec_z int

data modify entity @s interpolation_duration set value 1
data modify storage math:io cmp set from storage math:io stemp[0]
execute store success score temp int run data modify storage math:io cmp set from entity @s transformation
data modify entity @s transformation set from storage math:io cmp
execute store success score temp int run data modify storage math:io cmp set from storage math:io stemp[0]
execute if score temp int matches 1 run data modify entity @s start_interpolation set value 0

data remove storage math:io stemp[0]
14 changes: 7 additions & 7 deletions data/rot_aj/functions/set_bones.mcfunction
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#rot_aj:set_bones
execute store result score @s qrot_x run data get entity @s transformation.left_rotation[0] 10000
execute store result score @s qrot_y run data get entity @s transformation.left_rotation[1] 10000
execute store result score @s qrot_z run data get entity @s transformation.left_rotation[2] 10000
execute store result score @s qrot_w run data get entity @s transformation.left_rotation[3] 10000
execute store result score @s x run data get entity @s transformation.translation[0] 10000
execute store result score @s y run data get entity @s transformation.translation[1] 10000
execute store result score @s z run data get entity @s transformation.translation[2] 10000
execute store result score @s qrot_x run data get storage math:io cmp.left_rotation[0] 10000
execute store result score @s qrot_y run data get storage math:io cmp.left_rotation[1] 10000
execute store result score @s qrot_z run data get storage math:io cmp.left_rotation[2] 10000
execute store result score @s qrot_w run data get storage math:io cmp.left_rotation[3] 10000
execute store result score @s x run data get storage math:io cmp.translation[0] 10000
execute store result score @s y run data get storage math:io cmp.translation[1] 10000
execute store result score @s z run data get storage math:io cmp.translation[2] 10000

0 comments on commit f42b3d8

Please sign in to comment.