Skip to content

Commit a7a7451

Browse files
committed
implement custom version of player motion
- basically a fork that is renamespaced, version-checked, and uses the GM4 forceloaded chunk - licensing might not be correct in the release download
1 parent 8460a2e commit a7a7451

25 files changed

Lines changed: 305 additions & 104 deletions

gm4/plugins/refactor_external.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

lib_player_motion/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
# lib_player_motion
22
The [Player Motion](https://modrinth.com/datapack/player_motion) library prefixed with the GM4 namespace and properly versioned to prevent conflicts with other versions of player motion.
3+
4+
## changes
5+
The following usage changes have been made to the original player motion library:
6+
- The scoreboard objective `gm4_player_motion.api.launch` should be used instead of `player_motion.api.launch` when setting the parameters for the launch.
7+
- The function tags `#gm4_player_motion:launch_xyz` and `#gm4_player_motion:launch_looking` function tags should be used instead of the `player_motion:api/launch_xyz` and `player_motion:api/launch_looking` functions.
8+
9+
The following file changes have been made to the original player motion library:
10+
- The `#minecraft:load` function tag has been removed in favor of lantern load.
11+
- The `player_motion` namespace has been changed to `gm4_player_motion` to prevent potential conflicts with other versions of the player motion library.
12+
- The `player_motion:internal/technical/load` function has been moved to `gm4_player_motion:load` as per GM4 file conventions.
13+
- The `#gm4_player_motion:launch_xyz` and `#gm4_player_motion:launch_looking` functions tags have been added as version-checked API calls.
14+
15+
The following implementation changes have been made to the original player motion library:
16+
- All scoreboard objectives and storage references use `gm4_player_motion` instead of `player_motion` to prevent potential conflicts with other versions of the player motion library.
17+
- The UUID for the marker used to get vectors has been changed to a different UUID to prevent potential conflicts with other versions of the player motion library.
18+
- The marker is kept at 29999998 0 7133 instead of 0 0 0 to prevent forceloading 0 0; instead the GM4 forceloaded chunk is used to keep the marker selectable.

lib_player_motion/beet.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
id: gm4_player_motion
22
name: Gamemode 4 Player Motion
3-
version: 1.4.2
3+
version: 1.0.0
44

55
data_pack:
66
load:
7-
- https://cdn.modrinth.com/data/oDhxdGVZ/versions/aW4ph2OC/player_motion.zip
8-
- data: data
7+
data: data
98

109
pipeline:
11-
- gm4.plugins.refactor_external
1210
- gm4.plugins.extend.library
11+
- gm4.plugins.include.lib_forceload
1312

1413
meta:
1514
gm4:
16-
refactor_external:
17-
prefix: player_motion
1815
versioning:
16+
required:
17+
lib_forceload: 1.5.0
1918
schedule_loops: [internal/technical/tick]
2019
credits:
2120
Original Creator:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 BigPapi13, MulverineX
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

lib_player_motion/data/gm4_player_motion/function/api/launch_looking.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#> gm4_player_motion-1.4:api/launch_looking
1+
#> gm4_player_motion:api/launch_looking
22
# Launches the player in the input direction
33
execute if entity @s[type=!player] run return fail
44
execute on vehicle run return fail
@@ -7,7 +7,7 @@ scoreboard players set $function_called gm4_player_motion.internal.dummy 1
77
tag @s add gm4_player_motion.launch
88

99
execute store result storage gm4_player_motion:math strength double 0.0001 run scoreboard players get $strength gm4_player_motion.api.launch
10-
execute as 9a347e6c-1ce5-434a-b717-6707d51f4299 in minecraft:overworld positioned 0.0 0.0 0.0 run function gm4_player_motion-1.4:internal/math/looking_to_xyz with storage gm4_player_motion:math
10+
execute as 9a347e6c-1ce5-434a-b717-6707d51f4299 in minecraft:overworld positioned 0.0 0.0 0.0 run function gm4_player_motion:internal/math/looking_to_xyz with storage gm4_player_motion:math
1111
# ^ changed UUID to prevent potential conflict
1212
execute store result score $out gm4_player_motion.internal.motion.x run data get storage gm4_player_motion:math motion[0] 10000
1313
execute store result score $out gm4_player_motion.internal.motion.y run data get storage gm4_player_motion:math motion[1] 10000
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#> gm4_player_motion-1.4:api/launch_xyz
2+
# Launches the player in the input direction
3+
execute if entity @s[type=!player] run return fail
4+
execute on vehicle run return fail
5+
6+
scoreboard players set $function_called gm4_player_motion.internal.dummy 1
7+
tag @s add gm4_player_motion.launch
8+
9+
scoreboard players operation @s gm4_player_motion.internal.motion.x += $x gm4_player_motion.api.launch
10+
scoreboard players operation @s gm4_player_motion.internal.motion.y += $y gm4_player_motion.api.launch
11+
scoreboard players operation @s gm4_player_motion.internal.motion.z += $z gm4_player_motion.api.launch
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#> player_motion:internal/launch/exp_pos
1+
#> gm4_player_motion:internal/launch/exp_pos
22
$tp 9a347e6c-1ce5-434a-b717-6707d51f4299f ^ ^ ^$(d)
3-
# ^ (GM4) changed UUID to prevent potential conflict
3+
# ^ (GM4) changed UUID to prevent potential conflict
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#> gm4_player_motion:internal/launch/gamemode/get
2+
execute if entity @s[gamemode=survival] run return run scoreboard players set $mode gm4_player_motion.internal.gamemode 0
3+
execute if entity @s[gamemode=creative] run return run scoreboard players set $mode gm4_player_motion.internal.gamemode 1
4+
execute if entity @s[gamemode=adventure] run return run scoreboard players set $mode gm4_player_motion.internal.gamemode 2
5+
execute if entity @s[gamemode=spectator] run scoreboard players set $mode gm4_player_motion.internal.gamemode 3
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#> gm4_player_motion:internal/launch/gamemode/restore
2+
execute if score $mode gm4_player_motion.internal.gamemode matches 0 run return run gamemode survival @s
3+
execute if score $mode gm4_player_motion.internal.gamemode matches 1 run return run gamemode creative @s
4+
execute if score $mode gm4_player_motion.internal.gamemode matches 2 run return run gamemode adventure @s
5+
execute if score $mode gm4_player_motion.internal.gamemode matches 3 run gamemode spectator @s
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#> gm4_player_motion:internal/launch/main
2+
# Launches players in the input direction
3+
4+
execute \
5+
store result storage gm4_player_motion:math motion[0] double 0.0001 \
6+
store result storage gm4_player_motion:math motion_x double 0.0001 run \
7+
scoreboard players operation $motion_x gm4_player_motion.internal.math = @s gm4_player_motion.internal.motion.x
8+
execute \
9+
store result storage gm4_player_motion:math motion[1] double 0.0001 \
10+
store result storage gm4_player_motion:math motion_y double 0.0001 run \
11+
scoreboard players operation $motion_y gm4_player_motion.internal.math = @s gm4_player_motion.internal.motion.y
12+
execute \
13+
store result storage gm4_player_motion:math motion[2] double 0.0001 \
14+
store result storage gm4_player_motion:math motion_z double 0.0001 run \
15+
scoreboard players operation $motion_z gm4_player_motion.internal.math = @s gm4_player_motion.internal.motion.z
16+
17+
execute in minecraft:overworld run function gm4_player_motion:internal/math/main
18+
attribute @s knockback_resistance modifier add gm4_player_motion:disable_knockback_resistance -1 add_multiplied_total
19+
function gm4_player_motion:internal/launch/gamemode/get
20+
gamemode creative
21+
tp ~ ~10000 ~
22+
execute rotated as @s positioned ~ ~10000 ~ run function gm4_player_motion:internal/summon/main with storage gm4_player_motion:math
23+
tp ~ ~ ~
24+
function gm4_player_motion:internal/launch/gamemode/restore
25+
attribute @s knockback_resistance modifier remove gm4_player_motion:disable_knockback_resistance
26+
27+
scoreboard players set $function_called gm4_player_motion.internal.dummy 0
28+
tag @s remove gm4_player_motion.launch
29+
30+
# Reset scoreboards
31+
scoreboard players reset @s gm4_player_motion.internal.motion.x
32+
scoreboard players reset @s gm4_player_motion.internal.motion.y
33+
scoreboard players reset @s gm4_player_motion.internal.motion.z

0 commit comments

Comments
 (0)