Skip to content

Comments

🧑‍💻 tellraw を出力ごとに別の色で出力できるような debug fn を追加#2237

Merged
haiiro2gou merged 1 commit intomasterfrom
dev/print-with-alternating-color
Feb 21, 2026
Merged

🧑‍💻 tellraw を出力ごとに別の色で出力できるような debug fn を追加#2237
haiiro2gou merged 1 commit intomasterfrom
dev/print-with-alternating-color

Conversation

@ChenCMD
Copy link
Member

@ChenCMD ChenCMD commented Feb 21, 2026

PR デバッグ中の副産物

Copilot AI review requested due to automatic review settings February 21, 2026 07:54
@ChenCMD ChenCMD requested a review from haiiro2gou as a code owner February 21, 2026 07:54
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

tellraw のデバッグ出力を、呼び出しごとに色を交互に変えて見やすくするための debug 関数を追加するPRです。

Changes:

  • debug:print_with_alternating_colors.m を新規追加し、ストレージ状態に応じて tellraw の色を切り替える

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +20
$execute if data storage debug:print_with_alternating_colors {n:"odd" } run tellraw @a {"text":"","extra":$(Message),"color":"#FFFFFF"}
$execute if data storage debug:print_with_alternating_colors {n:"even"} run tellraw @a {"text":"","extra":$(Message),"color":"#C0C0C0"}
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

tellraw の JSON で extra は配列が必須ですが、ここでは extra:$(Message) になっていて Message が TextComponent オブジェクトの場合に JSON が不正になります(例: {...} がそのまま入る)。Message を 1 要素の配列に入れる形(または引数型を配列に統一)にして、常に有効な TextComponent になるよう修正してください。

Suggested change
$execute if data storage debug:print_with_alternating_colors {n:"odd" } run tellraw @a {"text":"","extra":$(Message),"color":"#FFFFFF"}
$execute if data storage debug:print_with_alternating_colors {n:"even"} run tellraw @a {"text":"","extra":$(Message),"color":"#C0C0C0"}
$execute if data storage debug:print_with_alternating_colors {n:"odd" } run tellraw @a {"text":"","extra":[$(Message)],"color":"#FFFFFF"}
$execute if data storage debug:print_with_alternating_colors {n:"even"} run tellraw @a {"text":"","extra":[$(Message)],"color":"#C0C0C0"}

Copilot uses AI. Check for mistakes.
# tellraw を出力ごとに別の色で出力します
#
# @input args
# Message: string (TextComponent) | TextComponent
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

@input args の型表記が、このコードベースでよく使われている string(TextComponent) 表記と異なり、string (TextComponent) | TextComponent になっています(例: TheSkyBlessing/data/api/functions/button/core/create_text_component.m.mcfunction:3)。表記を既存の形式に統一し、実際に受け付ける形式(TextComponent オブジェクト/配列/文字列)もコメントと実装で一致させてください。

Suggested change
# Message: string (TextComponent) | TextComponent
# Message: string(TextComponent)

Copilot uses AI. Check for mistakes.
Copy link
Member

@haiiro2gou haiiro2gou left a comment

Choose a reason for hiding this comment

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

imo: String 型や Object 型も TextComponent として扱われるようなので解釈する部分を用意するか @input を改善するかしたほうが良さそう?

@ChenCMD
Copy link
Member Author

ChenCMD commented Feb 21, 2026

まぁ、言うても使うタイミングで中身見る気がするので、そこまで詳細にしなくてもいいかな感

@haiiro2gou
Copy link
Member

じゃあいいか

@haiiro2gou haiiro2gou merged commit ce0f492 into master Feb 21, 2026
6 checks passed
@haiiro2gou haiiro2gou deleted the dev/print-with-alternating-color branch February 21, 2026 09:03
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.

2 participants