Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a new slide move library (lib:slide_move/) that moves entities forward while handling block collisions. The implementation is similar to the existing lib:reflection_bullet/ library but designed for sliding movement along obstacles rather than reflection.
Changes:
- Added main API function for slide move with argument validation and cleanup
- Implemented collision detection and movement geometry logic using macro functions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TheSkyBlessing/data/lib/functions/slide_move/.mcfunction | Main API entry point with argument validation, default value handling, and storage cleanup |
| TheSkyBlessing/data/lib/functions/slide_move/core/geometry.m.mcfunction | Core movement logic with axis-based collision detection and entity teleportation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # ファンクションの実行向きで前進&元の向きに戻す | ||
| $execute positioned as @s run tp @s ^ ^ ^$(Speed) ~ ~ |
There was a problem hiding this comment.
The entity will move twice the intended distance because both line 13 and line 16 execute unconditionally and both move forward by Speed. These appear to be two different movement modes ("Move forward with executor's rotation" vs "Move forward with function's execution rotation & restore original rotation") that should be mutually exclusive. One should likely be removed or they should be made conditional based on which mode is needed.
| # ファンクションの実行向きで前進&元の向きに戻す | |
| $execute positioned as @s run tp @s ^ ^ ^$(Speed) ~ ~ |
|
|
||
| # XYZ各軸のベクトル成分の位置のブロックを見て、合致しなければ軸方向の向きを反転 | ||
| $execute at @s positioned 0.0 0.0 0.0 positioned ^ ^ ^-1 positioned ~ 0.0 0.0 positioned ^ ^ ^0.5 facing 0.0 0.0 0.0 positioned as @s positioned ^ ^ ^$(Speed) rotated as @s unless block ^ ^ ^$(Speed) $(ThroughBlock) facing entity @s feet positioned as @s run tp @s ~ ~ ~ ~ ~ | ||
| $execute at @s positioned ^ ^ ^$(Speed) rotated ~180 ~ unless block ^ ^ ^$(Speed) $(ThroughBlock) facing ^ ^ ^-1 positioned as @s run tp @s ~ ~ ~ ~ ~ |
There was a problem hiding this comment.
The Y-axis collision detection logic appears incorrect. Line 9 attempts to handle Y-axis collisions but doesn't zero out X and Z coordinates like the X-axis (line 8 with "positioned ~ 0.0 0.0") and Z-axis (line 10 with "positioned 0.0 0.0 ~") handlers do. Comparing to the similar reflection_bullet library, the Y-axis handler should use "positioned ~ 0.0 ~" to isolate Y-axis movement. Additionally, using horizontal rotation (~180) doesn't make geometric sense for vertical axis collision detection.
| $execute at @s positioned ^ ^ ^$(Speed) rotated ~180 ~ unless block ^ ^ ^$(Speed) $(ThroughBlock) facing ^ ^ ^-1 positioned as @s run tp @s ~ ~ ~ ~ ~ | |
| $execute at @s positioned 0.0 0.0 0.0 positioned ^ ^ ^-1 positioned ~ 0.0 ~ positioned ^ ^ ^0.5 facing 0.0 0.0 0.0 positioned as @s positioned ^ ^ ^$(Speed) rotated as @s unless block ^ ^ ^$(Speed) $(ThroughBlock) facing entity @s feet positioned as @s run tp @s ~ ~ ~ ~ ~ |
No description provided.