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. 待观察。