Skip to content

Comments

ブロックに引っかかる前進ライブラリを実装#2236

Open
komaramune wants to merge 1 commit intomasterfrom
dev/komaramune_slide_move
Open

ブロックに引っかかる前進ライブラリを実装#2236
komaramune wants to merge 1 commit intomasterfrom
dev/komaramune_slide_move

Conversation

@komaramune
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings February 19, 2026 17:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +14 to +16

# ファンクションの実行向きで前進&元の向きに戻す
$execute positioned as @s run tp @s ^ ^ ^$(Speed) ~ ~
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# ファンクションの実行向きで前進&元の向きに戻す
$execute positioned as @s run tp @s ^ ^ ^$(Speed) ~ ~

Copilot uses AI. Check for mistakes.

# 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 ~ ~ ~ ~ ~
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
$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 ~ ~ ~ ~ ~

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant