🐛 ScoreToHealth 干渉中も正しい最大体力を返すよう修正#2266
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
ScoreToHealth による一時的な generic.max_health modifier 干渉中でも、プレイヤーの「本来の最大体力」を参照できるようにして api:entity/player/get_health_per の HealthPer が一時的に 1.0 を超える不具合(#2263)を抑止するPRです。
Changes:
core:tick/player/preのタイミングで最大体力を OhMyDat に条件付きでキャッシュする処理を追加- 最大体力取得API
api:modifier/max_health/getを OhMyDat キャッシュ参照として復元 api:entity/player/get_health_perを上記 API 経由の最大体力参照に戻す
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TheSkyBlessing/data/player_manager/functions/cache_max_health.mcfunction | ScoreToHealth干渉を避けた最大体力のキャッシュ更新を追加 |
| TheSkyBlessing/data/core/functions/tick/player/pre.mcfunction | pre tick に最大体力キャッシュ更新呼び出しを追加 |
| TheSkyBlessing/data/api/functions/modifier/max_health/get.mcfunction | 最大体力取得APIをOhMyDatキャッシュ読み出しとして追加 |
| TheSkyBlessing/data/api/functions/entity/player/get_health_per.mcfunction | 最大体力取得を attribute 直読から API 経由に切替 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
Linter がぶっ壊れているのはローカルの方でした、アホ |
96f47d1 to
d3da810
Compare
Member
Author
|
本当は |
haiiro2gou
requested changes
May 26, 2026
Member
haiiro2gou
left a comment
There was a problem hiding this comment.
WANT: score_to_health:player_tick の restore 呼び出し部分をコメントアウトしていいんじゃない?
haiiro2gou
approved these changes
May 26, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2263
api:entity/player/get_health_per(および同じくattribute @s generic.max_health get直読みしている箇所) で、 プレイヤーが HP 変化した直後の 1〜2 tick だけ HealthPer が 1.0 を超える不具合の修正。原因
PR #2248 で
api:modifier/max_health/getを破棄し、attribute @s generic.max_health getを直接読むようにした影響。ScoreToHealth ライブラリは
instant_health 1 252で体力を目標値に揃えるため、 1 tick だけ max_health 属性に大量の負の modifier (UUID prefixbab7cdc2-fb6a-47f6-0001-*) を一時付与する。 そのタイミングで attribute から最大体力を読むと target 値 (= 低い値) が返ってしまい、 OhMyDat キャッシュ越しに読んでるHealth(damage 反映前) と並べるとHealth / MaxHealth > 1.0が成立する。修正方針
ScoreToHealth が次 tick の advancement (entity tick フェーズ) で行う
score_to_health:restoreを、 同じ tick の function tick の最先頭 で先回りで実行する。 これによりcore:tick/全域での attribute 直読みは干渉値ではなく真値を返すようになる。