-
Notifications
You must be signed in to change notification settings - Fork 6
👽 PlayerMotion ライブラリを 1.20.4 向けにフォーク #2163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
haiiro2gou
wants to merge
6
commits into
master
Choose a base branch
from
dev/player-motion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f3afc36
:alien: PlayerMotion ライブラリを 1.20.4 向けにフォーク
haiiro2gou ef29835
:recycle: TSB のコード規約に合わせてコード全体を修正
haiiro2gou d5aff3e
:truck: lib フォルダ内に呼び出し処理を移動
haiiro2gou 693ca00
Merge branch 'master' into dev/player-motion
EllaCoat 42dc252
:memo: IMP-Doc を修正
haiiro2gou a14f2d1
:truck: `lib:motion/` に処理を統合
haiiro2gou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2024 BigPapi13, MulverineX | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "values" : [ | ||
| "player_motion:internal/technical/load" | ||
| ] | ||
| } |
22 changes: 22 additions & 0 deletions
22
PlayerMotion/data/player_motion/functions/api/launch_looking.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #> player_motion:api/launch_looking | ||
| # | ||
| # Launches the player in the input direction | ||
| # | ||
| # @api | ||
|
|
||
| execute if entity @s[type=!player] run return fail | ||
| execute on vehicle run return fail | ||
|
|
||
| scoreboard players set $function_called PlayerMotion.Internal.Dummy 1 | ||
| tag @s add PlayerMotion.Launch | ||
|
|
||
| execute store result storage player_motion:math strength double 0.0001 run scoreboard players get $strength PlayerMotion.Api.Launch | ||
| execute as 0-0-0-0-0 in minecraft:overworld positioned 0.0 0.0 0.0 run function player_motion:internal/math/looking_to_xyz with storage player_motion:math | ||
|
|
||
| execute store result score $out PlayerMotion.Internal.Motion.X run data get storage player_motion:math motion[0] 10000 | ||
| execute store result score $out PlayerMotion.Internal.Motion.Y run data get storage player_motion:math motion[1] 10000 | ||
| execute store result score $out PlayerMotion.Internal.Motion.Z run data get storage player_motion:math motion[2] 10000 | ||
|
|
||
| scoreboard players operation @s PlayerMotion.Internal.Motion.X += $out PlayerMotion.Internal.Motion.X | ||
| scoreboard players operation @s PlayerMotion.Internal.Motion.Y += $out PlayerMotion.Internal.Motion.Y | ||
| scoreboard players operation @s PlayerMotion.Internal.Motion.Z += $out PlayerMotion.Internal.Motion.Z |
15 changes: 15 additions & 0 deletions
15
PlayerMotion/data/player_motion/functions/api/launch_xyz.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #> player_motion:api/launch_xyz | ||
| # | ||
| # Launches the player in the input direction | ||
| # | ||
| # @api | ||
|
|
||
| execute if entity @s[type=!player] run return fail | ||
| execute on vehicle run return fail | ||
|
|
||
| scoreboard players set $function_called PlayerMotion.Internal.Dummy 1 | ||
| tag @s add PlayerMotion.Launch | ||
|
|
||
| scoreboard players operation @s PlayerMotion.Internal.Motion.X += $x PlayerMotion.Api.Launch | ||
| scoreboard players operation @s PlayerMotion.Internal.Motion.Y += $y PlayerMotion.Api.Launch | ||
| scoreboard players operation @s PlayerMotion.Internal.Motion.Z += $z PlayerMotion.Api.Launch |
4 changes: 4 additions & 0 deletions
4
PlayerMotion/data/player_motion/functions/internal/launch/exp_pos.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #> player_motion:internal/launch/exp_pos | ||
| # @private | ||
|
|
||
| $tp 0-0-0-0-0 ^ ^ ^$(d) |
7 changes: 7 additions & 0 deletions
7
PlayerMotion/data/player_motion/functions/internal/launch/gamemode/get.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #> player_motion:internal/launch/gamemode/get | ||
| # @within function player_motion:internal/launch/main | ||
|
|
||
| execute if entity @s[gamemode=survival] run return run scoreboard players set $mode PlayerMotion.Internal.Gamemode 0 | ||
| execute if entity @s[gamemode=creative] run return run scoreboard players set $mode PlayerMotion.Internal.Gamemode 1 | ||
| execute if entity @s[gamemode=adventure] run return run scoreboard players set $mode PlayerMotion.Internal.Gamemode 2 | ||
| execute if entity @s[gamemode=spectator] run scoreboard players set $mode PlayerMotion.Internal.Gamemode 3 |
7 changes: 7 additions & 0 deletions
7
PlayerMotion/data/player_motion/functions/internal/launch/gamemode/restore.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #> player_motion:internal/launch/gamemode/restore | ||
| # @within function player_motion:internal/launch/main | ||
|
|
||
| execute if score $mode PlayerMotion.Internal.Gamemode matches 0 run return run gamemode survival @s | ||
| execute if score $mode PlayerMotion.Internal.Gamemode matches 1 run return run gamemode creative @s | ||
| execute if score $mode PlayerMotion.Internal.Gamemode matches 2 run return run gamemode adventure @s | ||
| execute if score $mode PlayerMotion.Internal.Gamemode matches 3 run gamemode spectator @s |
27 changes: 27 additions & 0 deletions
27
PlayerMotion/data/player_motion/functions/internal/launch/main.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #> player_motion:internal/launch/main | ||
| # | ||
| # Launches players in the input direction | ||
| # | ||
| # @within function player_motion:internal/technical/tick | ||
|
|
||
| execute store result storage player_motion:math motion[0] double 0.0001 store result storage player_motion:math motion_x double 0.0001 run scoreboard players operation $motion_x PlayerMotion.Internal.Math = @s PlayerMotion.Internal.Motion.X | ||
| execute store result storage player_motion:math motion[1] double 0.0001 store result storage player_motion:math motion_y double 0.0001 run scoreboard players operation $motion_y PlayerMotion.Internal.Math = @s PlayerMotion.Internal.Motion.Y | ||
| execute store result storage player_motion:math motion[2] double 0.0001 store result storage player_motion:math motion_z double 0.0001 run scoreboard players operation $motion_z PlayerMotion.Internal.Math = @s PlayerMotion.Internal.Motion.Z | ||
|
|
||
| execute in minecraft:overworld run function player_motion:internal/math/main | ||
| # attribute @s explosion_knockback_resistance modifier add player_motion:disable_knockback_resistance -1 add_multiplied_total | ||
| function player_motion:internal/launch/gamemode/get | ||
| gamemode creative | ||
| tp ~ ~10000 ~ | ||
| execute rotated as @s positioned ~ ~10000 ~ run function player_motion:internal/summon/main with storage player_motion:math | ||
| tp ~ ~ ~ | ||
| function player_motion:internal/launch/gamemode/restore | ||
| # attribute @s explosion_knockback_resistance modifier remove player_motion:disable_knockback_resistance | ||
|
|
||
| scoreboard players set $function_called PlayerMotion.Internal.Dummy 0 | ||
| tag @s remove PlayerMotion.Launch | ||
|
|
||
| # Reset scoreboards | ||
| scoreboard players reset @s PlayerMotion.Internal.Motion.X | ||
| scoreboard players reset @s PlayerMotion.Internal.Motion.Y | ||
| scoreboard players reset @s PlayerMotion.Internal.Motion.Z | ||
9 changes: 9 additions & 0 deletions
9
PlayerMotion/data/player_motion/functions/internal/math/eyelevel.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #> player_motion:internal/math/eyelevel | ||
| # @within function player_motion:internal/math/main | ||
|
|
||
| # eyelevel=y(eyes)-y(player) | ||
| execute anchored eyes positioned ^ ^ ^ if entity @s[distance=...41] run return run scoreboard players set $eyelevel PlayerMotion.Internal.Math 40 | ||
|
haiiro2gou marked this conversation as resolved.
|
||
|
|
||
| execute anchored eyes positioned ^ ^ ^ if entity @s[distance=..1.27] run return run scoreboard players set $eyelevel PlayerMotion.Internal.Math 127 | ||
|
|
||
| scoreboard players set $eyelevel PlayerMotion.Internal.Math 162 | ||
6 changes: 6 additions & 0 deletions
6
PlayerMotion/data/player_motion/functions/internal/math/full_power/sine.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #> player_motion:internal/math/full_power/sine | ||
| # @within function player_motion:internal/math/full_power/trig | ||
|
|
||
| $execute store result score $n_full_exp PlayerMotion.Internal.Math run data get storage player_motion:trig arr[$(angle)] | ||
| scoreboard players operation $n_full_exp PlayerMotion.Internal.Math *= $motion_y PlayerMotion.Internal.Math | ||
| execute store result score $sub_power PlayerMotion.Internal.Math run scoreboard players operation $n_full_exp PlayerMotion.Internal.Math /= $1000 Const |
10 changes: 10 additions & 0 deletions
10
PlayerMotion/data/player_motion/functions/internal/math/full_power/tp.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #> player_motion:internal/math/full_power/tp | ||
| # @within function player_motion:internal/math/full_power/trig | ||
|
|
||
| execute store result storage player_motion:math pos[0] double 0.1 run scoreboard players get $motion_x PlayerMotion.Internal.Math | ||
| execute store result storage player_motion:math pos[1] double 0.1 run scoreboard players get $motion_y PlayerMotion.Internal.Math | ||
| execute store result storage player_motion:math pos[2] double 0.1 run scoreboard players get $motion_z PlayerMotion.Internal.Math | ||
| data modify entity @s Pos set from storage player_motion:math pos | ||
| execute at @s facing 0.0 0.0 0.0 run tp @s 0 0 0 0 ~ | ||
| function api:data_get/rotation | ||
| execute store result storage player_motion:math magnitude.angle int 1 run data get storage api: Rotation[1] 100 | ||
|
haiiro2gou marked this conversation as resolved.
|
||
5 changes: 5 additions & 0 deletions
5
PlayerMotion/data/player_motion/functions/internal/math/full_power/trig.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #> player_motion:internal/math/full_power/trig | ||
| # @within function player_motion:internal/math/main | ||
|
|
||
| execute as 0-0-0-0-0 run function player_motion:internal/math/full_power/tp | ||
| function player_motion:internal/math/full_power/sine with storage player_motion:math magnitude |
6 changes: 6 additions & 0 deletions
6
PlayerMotion/data/player_motion/functions/internal/math/looking_to_xyz.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #> player_motion:internal/math/looking_to_xyz | ||
| # @within function player_motion:api/launch_looking | ||
|
|
||
| $tp @s ^ ^ ^$(strength) | ||
| data modify storage player_motion:math motion set from entity @s Pos | ||
| tp @s 0.0 0.0 0.0 |
106 changes: 106 additions & 0 deletions
106
PlayerMotion/data/player_motion/functions/internal/math/main.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| #> player_motion:internal/math/main | ||
| # @within function player_motion:internal/launch/main | ||
|
|
||
| # full_power=sqrt(motion_x²+motion_y²+motion_z²) | ||
| # Save sign of $motion_y | ||
| execute store success score $negative_sine PlayerMotion.Internal.Math if score $motion_y PlayerMotion.Internal.Math matches ..-1 | ||
|
|
||
| # Normalize | ||
| execute if score $motion_x PlayerMotion.Internal.Math matches ..-1 run scoreboard players operation $motion_x PlayerMotion.Internal.Math *= $-1 Const | ||
|
|
||
| execute if score $motion_y PlayerMotion.Internal.Math matches ..-1 run scoreboard players operation $motion_y PlayerMotion.Internal.Math *= $-1 Const | ||
|
|
||
| execute if score $motion_z PlayerMotion.Internal.Math matches ..-1 run scoreboard players operation $motion_z PlayerMotion.Internal.Math *= $-1 Const | ||
|
|
||
| # Sets angle before exchange | ||
| scoreboard players set $angle PlayerMotion.Internal.Math 0 | ||
|
|
||
| execute if score $motion_y PlayerMotion.Internal.Math matches 0 run scoreboard players set $angle PlayerMotion.Internal.Math 1 | ||
|
|
||
| # SuperSwordTW's method. Credit: https://github.com/SuperSwordTW/Distance-Trig-Calc-3d | ||
| execute if score $motion_y PlayerMotion.Internal.Math matches 0 run scoreboard players operation $motion_y PlayerMotion.Internal.Math >< $motion_x PlayerMotion.Internal.Math | ||
|
|
||
| execute if score $motion_y PlayerMotion.Internal.Math matches 0 run scoreboard players operation $motion_y PlayerMotion.Internal.Math >< $motion_z PlayerMotion.Internal.Math | ||
|
|
||
| function player_motion:internal/math/full_power/trig | ||
|
|
||
| # n_full_exp=floor(full_power/0.865) | ||
| scoreboard players operation $n_full_exp PlayerMotion.Internal.Math /= $8000 Const | ||
|
|
||
| # Change back the angle | ||
| execute if score $angle PlayerMotion.Internal.Math matches 1 run data modify storage player_motion:math magnitude.angle set value 0 | ||
|
|
||
| # eyelevel=y(eyes)-y(player) | ||
| function player_motion:internal/math/eyelevel | ||
|
|
||
| # sub power operations | ||
| # sub_power=floor(full_power%0.8) | ||
| scoreboard players operation $sub_power PlayerMotion.Internal.Math %= $8000 Const | ||
|
|
||
| # d12=1-sub_power | ||
| scoreboard players set $d12 PlayerMotion.Internal.Math 10000 | ||
| scoreboard players operation $d12 PlayerMotion.Internal.Math -= $sub_power PlayerMotion.Internal.Math | ||
|
|
||
| # Formula d=-(eyelevel*sinα + d12*12 * cos(arcsin(cosα*eyelevel/(d12*12)))) | ||
|
|
||
| # d12 = d12*12 | ||
| scoreboard players operation $d12 PlayerMotion.Internal.Math *= $12 Const | ||
|
|
||
| # Obtain sinα and cosα | ||
| function player_motion:internal/math/trig/sine with storage player_motion:math magnitude | ||
|
|
||
| # cosα *= eyelevel, record cosα for later use | ||
| scoreboard players operation $cosine PlayerMotion.Internal.Math *= $eyelevel PlayerMotion.Internal.Math | ||
| scoreboard players operation $cosine1 PlayerMotion.Internal.Math = $cosine PlayerMotion.Internal.Math | ||
|
|
||
| # cosα /= d12 = cosα*eyelevel / (d12*12) | ||
| scoreboard players operation $cosine PlayerMotion.Internal.Math *= $10 Const | ||
|
|
||
| scoreboard players operation $cosine PlayerMotion.Internal.Math /= $d12 PlayerMotion.Internal.Math | ||
|
|
||
| # obtain cos(arcsin(cosα*eyelevel/(d12*12)))) | ||
| execute store result storage player_motion:math magnitude.quotient int 1 run scoreboard players get $cosine PlayerMotion.Internal.Math | ||
|
|
||
| function player_motion:internal/math/trig/arcsine with storage player_motion:math magnitude | ||
|
|
||
| # cos(arcsin(cosα*eyelevel/(d12)))) *= d12 | ||
| scoreboard players operation $d PlayerMotion.Internal.Math *= $d12 PlayerMotion.Internal.Math | ||
|
|
||
| scoreboard players operation $d PlayerMotion.Internal.Math /= $1000 Const | ||
|
|
||
| # sinα *= eyelevel, record sine for later use | ||
| scoreboard players operation $sine PlayerMotion.Internal.Math *= $eyelevel PlayerMotion.Internal.Math | ||
|
|
||
| scoreboard players operation $sine PlayerMotion.Internal.Math /= $10 Const | ||
|
|
||
| scoreboard players operation $sine1 PlayerMotion.Internal.Math = $sine PlayerMotion.Internal.Math | ||
|
|
||
| # d += sine | ||
| execute store result storage player_motion:math d double -0.0001 run scoreboard players operation $d PlayerMotion.Internal.Math += $sine PlayerMotion.Internal.Math | ||
|
|
||
|
|
||
| # full power operations | ||
| # d12=1-fpc(0.8) = 0.2 | ||
| scoreboard players set $d12 PlayerMotion.Internal.Math 2000 | ||
|
|
||
| #full_d = -(eyelevel*sinα + (d12*12)*cos(arcsin(cosα*eyelevel/(d12*12)))) | ||
|
|
||
| # d12 = d12*12 | ||
| scoreboard players operation $d12 PlayerMotion.Internal.Math *= $12 Const | ||
|
|
||
| # cosine1 = cosα*eyelevel, cosine1 /= d12 | ||
| scoreboard players operation $cosine1 PlayerMotion.Internal.Math *= $10 Const | ||
|
|
||
| scoreboard players operation $cosine1 PlayerMotion.Internal.Math /= $d12 PlayerMotion.Internal.Math | ||
|
|
||
| # Obtain cos(arcsin(cosine1)) | ||
| execute store result storage player_motion:math magnitude.quotient int 1 run scoreboard players get $cosine1 PlayerMotion.Internal.Math | ||
|
|
||
| function player_motion:internal/math/trig/arcsine with storage player_motion:math magnitude | ||
|
|
||
| # cos(arcsin(cosα*eyelevel/(d12)))) *= d12 | ||
| scoreboard players operation $d PlayerMotion.Internal.Math *= $d12 PlayerMotion.Internal.Math | ||
| scoreboard players operation $d PlayerMotion.Internal.Math /= $1000 Const | ||
|
|
||
| # d += sine1 | ||
| execute store result storage player_motion:math full_d double -0.0001 run scoreboard players operation $d PlayerMotion.Internal.Math += $sine1 PlayerMotion.Internal.Math |
4 changes: 4 additions & 0 deletions
4
PlayerMotion/data/player_motion/functions/internal/math/trig/arcsine.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #> player_motion:internal/math/trig/arcsine | ||
| # @within function player_motion:internal/math/main | ||
|
|
||
| $execute store result score $d PlayerMotion.Internal.Math run data get storage player_motion:arcsine arr[$(quotient)] |
6 changes: 6 additions & 0 deletions
6
PlayerMotion/data/player_motion/functions/internal/math/trig/sine.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #> player_motion:internal/math/trig/sine | ||
| # @within function player_motion:internal/math/main | ||
|
|
||
| $execute store result score $sine PlayerMotion.Internal.Math run data get storage player_motion:sine arr[$(angle)] | ||
| execute if score $negative_sine PlayerMotion.Internal.Math matches 1 run scoreboard players operation $sine PlayerMotion.Internal.Math *= $-1 Const | ||
| $execute store result score $cosine PlayerMotion.Internal.Math run data get storage player_motion:cosine arr[$(angle)] |
5 changes: 5 additions & 0 deletions
5
PlayerMotion/data/player_motion/functions/internal/summon/crystal.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #> player_motion:internal/summon/crystal | ||
| # @within function player_motion:internal/summon/main | ||
|
|
||
| $execute if score $n_full_exp PlayerMotion.Internal.Math matches 1.. anchored eyes positioned ^ ^ ^$(full_d) run function player_motion:internal/summon/loop | ||
| $execute anchored eyes positioned ^ ^ ^$(d) summon end_crystal run damage @s 0 |
8 changes: 8 additions & 0 deletions
8
PlayerMotion/data/player_motion/functions/internal/summon/loop.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #> player_motion:internal/summon/loop | ||
| # @within function | ||
| # player_motion:internal/summon/crystal | ||
| # player_motion:internal/summon/loop | ||
|
|
||
| scoreboard players remove $n_full_exp PlayerMotion.Internal.Math 1 | ||
| execute summon end_crystal run damage @s 0 | ||
| execute if score $n_full_exp PlayerMotion.Internal.Math matches 1.. run function player_motion:internal/summon/loop |
3 changes: 3 additions & 0 deletions
3
PlayerMotion/data/player_motion/functions/internal/summon/main.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #> player_motion:internal/summon/main | ||
|
|
||
| $execute facing ~$(motion_x) ~$(motion_y) ~$(motion_z) run function player_motion:internal/summon/crystal with storage player_motion:math |
46 changes: 46 additions & 0 deletions
46
PlayerMotion/data/player_motion/functions/internal/technical/load.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #> player_motion:internal/technical/load | ||
| # @within tag/function minecraft:load | ||
|
|
||
| #> STORAGE | ||
| # @public | ||
| #declare storage player_motion:math | ||
| data modify storage player_motion:math unitvector set value [0.0d,0.0d,0.0d] | ||
| data modify storage player_motion:math motion set value [0.0d,0.0d,0.0d] | ||
| data modify storage player_motion:math pos set value [0.0d,0.0d,0.0d] | ||
|
|
||
| # TICK FUNCTION | ||
| schedule function player_motion:internal/technical/tick 1t append | ||
|
haiiro2gou marked this conversation as resolved.
|
||
|
|
||
| #> OBJECTIVE | ||
|
|
||
| #> Launch Api | ||
| # @api | ||
| scoreboard objectives add PlayerMotion.Api.Launch dummy | ||
|
|
||
| #> Internal | ||
| # @within function player_motion:** | ||
| scoreboard objectives add PlayerMotion.Internal.Dummy dummy | ||
| scoreboard objectives add PlayerMotion.Internal.Math dummy | ||
| scoreboard objectives add PlayerMotion.Internal.Math.Sqrt dummy | ||
| scoreboard objectives add PlayerMotion.Internal.Motion.X dummy | ||
| scoreboard objectives add PlayerMotion.Internal.Motion.Y dummy | ||
| scoreboard objectives add PlayerMotion.Internal.Motion.Z dummy | ||
| scoreboard objectives add PlayerMotion.Internal.Gamemode dummy | ||
|
|
||
| #> TAG | ||
| # @within function | ||
| # player_motion:api/** | ||
| # player_motion:internal/launch/main | ||
| # player_motion:internal/technical/tick | ||
| #declare tag PlayerMotion.Launch | ||
|
|
||
| # FORCELOAD | ||
| # forceload add 0 0 | ||
|
|
||
| # MARKER | ||
| # kill d4bd74a7-4e82-4a07-8850-dfc4d89f9e2f | ||
| # summon marker 0.0 0.0 0.0 {UUID:[I; -725781337, 1317161479, -2007965756, -660627921], Tags:["smithed.strict", "smithed.entity"]} | ||
|
|
||
|
|
||
| # TRIG LOOKUP TABLE: | ||
| function player_motion:internal/technical/trig | ||
10 changes: 10 additions & 0 deletions
10
PlayerMotion/data/player_motion/functions/internal/technical/tick.mcfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #> player_motion:internal/technical/tick | ||
| # @within function | ||
| # player_motion:internal/technical/load | ||
| # player_motion:internal/technical/tick | ||
|
|
||
| # TICK FUNCTION | ||
| schedule function player_motion:internal/technical/tick 1t append | ||
|
haiiro2gou marked this conversation as resolved.
|
||
|
|
||
| # LAUNCH PLAYERS | ||
| execute if score $function_called PlayerMotion.Internal.Dummy matches 1 as @a[tag=PlayerMotion.Launch] at @s run function player_motion:internal/launch/main | ||
16 changes: 16 additions & 0 deletions
16
PlayerMotion/data/player_motion/functions/internal/technical/trig.mcfunction
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "pack": { | ||
| "pack_format": 26, | ||
| "description": "player_motion datapack - 1.20.4 fork" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.