JSON UI/DevAssertionHandle

出自Minecraft基岩版开发Wiki

Minecraft 基岩引擎下的 JSON-UI 在開發環境下遵循嚴格的程式碼規範,儘管這一切在零售版本幾乎不會有任何可視化的顯現,但是在特定的情況下構建相關程式碼集群,最優解還是儘可能避免任何能被糾錯程式檢測出的問題,如果你位於開發環境下且想要跳過相關報錯,請前往設定-除錯介面關閉断点显示日志调试器中的断点测试開關,或者在開發控制台中輸入指令/option set dev_assertions_debug_break false/option set dev_assertions_show_dialog false並執行,特別需要注意的是调试器中的断点测试的設定優先級應高於断点显示日志,這是由於標準Minecraft Dev是能在不連結到除錯器的情況下執行的,這也符合絕大多數情況(待定),因此此時並無控制台程式用於輸出除錯資訊,斷言錯誤將直接導致目前Minecraft實例終止。

常見的 JSON-UI 斷言錯誤及可能的解決方案[編輯]

斷言錯誤核心內容 是否為惡性遞歸錯誤 解決方案
Type not specified (or @-base not found) for control: assertion_failure 檢查程式碼欄位中assertion_failure@$abc123,通常情況下全域變數$abc123不存在或無法識別會造成此問題。另一種特殊情況是組的子節點需要寫到controls變數內,而不能被引用,可能在stack_panelinput_panel元件下出現。
Invalid rectangle area Condition is false: (x0 <= x1 && y0 <= y1) (checkForValidity == false) 檢查是否有將原stack_panel控制項下的物件放入該父物件下panel控制項內的情況,此時線性布局出現了錯亂,嘗試恢復原stack_panel下物件的排列方式。
UIControlFactory failed to create child control, did you add a new type? Did you add it to the string-to-type function?Condition is false: childControl 檢查是否存在某一物件設定的type變數不合規情況,此類問題解決一般需要一定的經驗,建議從能夠確認無問題的最上層節點往下逐一排查。
Could not find tab to select 硬編碼決定了部分介面必須具備toggle_namenavigation_tab的特定開關,隨意增刪處於同一開關組的開關名容易出現此類問題。如$toggle_group_forced_index變數值為$accessibility_index$construction_index$nature_index$items_index$equipment_index的相關控制項。此類錯誤無關緊要。
childBatchClippingState.mBottomRightClip should always be >= mTopLeftClip. FYI mClipsChildren == trueCondition is false: childBatchClippingState.mBottomRightClip.x >= childBatchClippingState.mTopLeftClip.x && childBatchClippingState.mBottomRightClip.y >= childBatchClippingState.mTopLeftClip 此類問題一般出現在scroll_panel控制項嵌套scroll_panel的情況下,當子控制項的大小與父控制項大小相差懸殊或不符合特定情境下硬性要求時,此類報錯會在拖動滾輪(鍵鼠)或滑動窗體(觸控)時不間斷出現,但在捲動滑鼠滑輪與上下實體鍵映射時不會出現相應報錯。該報錯延展到零售版本的直觀體現為滑動操作中途Minecraft實例卡頓明顯至無響應,暫無完美解決方案。
Invalid rectangle area Condition is false: (x0 <= x1 && y0 <= y1) (checkForValidity == false) 此類問題一般也出現在scroll_panel控制項嵌套scroll_panel的情況下,且與上條斷言錯誤同時發生。當子控制項的大小與父控制項大小相差懸殊或不符合特定情境下硬性要求時,此類報錯會在拖動滾輪(鍵鼠)或滑動窗體(觸控)時不間斷出現,但在捲動滑鼠滑輪與上下實體鍵映射時不會出現相應報錯。該報錯延展到零售版本的直觀體現為滑動操作中途Minecraft實例卡頓明顯至無響應,暫無完美解決方案。
We have invalid names in the vanilla files.Make sure all your control children have unique names that aren't empty! 同一節點下物件名應該不同。
This control needs a layout component!Condition is false: mLayoutComponent 待觀察。
Unsolvable layout rule set.Condition is false: false 同一stack_panel控制項下不能同時嵌套兩個或多個scrolling_panel控制項。stack_panel控制項下的節點不能含有高度為100%的控制項。
UI control reference not found: 'dock_exit_animation_push_offset' 除該控制項確實不存在的情況外,一般也出現在動畫變數中,儘可能保持動畫變數繼承控制項帶命名空間的完整性。
Data bindings must have at least one property to bind! bindings變數內容不完整。
Invalid Index was received. Most likely due to controls not being removed when the respective grid resized. collection_index變數值超出對應grid控制項應有值。
Should not be trying to push the start menu to a ClientInstance scenestack! 在遊戲內(hud推入後)開啟安全區變更介面。
UIControlFactory - failed to create root control.Condition is false: subTreeControl != nullptr grid元件grid_item_template變數值指向一個不存在的控制項。
gridItemTemplate control tree could not be created! Condition is false: gridItemTemplate != nullptr grid元件grid_item_template變數值指向一個不存在的控制項。(伴隨上一斷言失敗出現)
Invalid Index was received. Most likely due to controls not being removed when the respective grid resized. 待觀察。