Rules: Pattern recipes
scripts/gen-rules.mjs builds this page from rules/*.json. Do not edit it by hand; edit the JSON and run npm run gen-rules. The rule bullets on topic pages (- **[ID]**) are filled from the same source.
Explanations and examples are on the topic page Pattern recipes.
| ID | Rule | Level | Evidence environment | Source |
|---|---|---|---|---|
| PAT-01 | The minimal setup of an action form custom screen is (1) hide vanilla long_form and custom_form by a title prefix, (2) put a second factory that uses server_form_factory into main_screen_content, and (3) make your own screen. | code (source), working pack | - | BC 4.1-(1), BA chapter 2, VN server_form.json |
| PAT-02 | For a pressable cell, put collection_details + the form_button_click mapping on the button itself, and for a cell that draws a value, put a collection binding on the label itself. | measured, vanilla, code (source) | unknown | BC-S1, BC-S7, BC 4.1-(3) and (4), VN server_form.json:211-246 |
| PAT-03 | Put one size-0 data source control at the screen root, and have the gates read that value with a source_control_name view binding. | code (source) | - | BC 4.1-(5), BC-samples home.document.json |
| PAT-04 | Instead of visible, gate with a factory that computes #collection_length and creates nothing when it is 0. | measured | unknown | BC-S11, BC-S8 |
| PAT-05 | Carry byte-width-fixed fields like [kind 5][number 4][title …] in one entry string, and take them out by cutting, subtracting, cutting again, then removing padding. | working pack | - | BA chapter 3, AP 4.5 |
| PAT-06 | Stack power-of-two size spacers in a vertical stack and turn each on and off with a bit token, and the sum of the sizes of the spacers that are on becomes the y coordinate. The number of controls grows by the bit count, so page when there are many items. | working pack | - | BA chapter 4 |
| PAT-07 | Put the tab content inside each toggle's checked state control of a radio toggle group, and give all 8 states and the toggle mappings. | measured | unknown | BC-S4, BC chapter 5, BC-samples tabbed.document.json |
| PAT-08 | Place one more hud_title_text_factory in a layer inside the HUD to make toasts, and hide the vanilla title when it has my prefix. Every time a title is sent a control is newly created, so the animation plays from the beginning. | working pack | - | BA chapter 6, AP 4.1, AP-samples hud_screen.json |
| PAT-09 | Place one more chat_item_factory in my layer (set the maximum count) and show only messages with my prefix. In the original chat, hide it in two places: messages_text of chat_screen.json and the HUD chat_grid_item. When disappearing, shrinking the height to 0 with a size animation pulls the stack up. | working pack | - | AP 4.5, AP-samples hud_screen.json and chat_screen.json |
| PAT-10 | Give the bar image clip_direction and bind #clip_ratio (the ratio to cut off, 0~1). A decimal is needed, so turn an integer value into 0~1 by multiplying by a real literal that starts with a dot, as in (#v * .01) (EXP-18). (#v / 100) is an integer. | vanilla, measured | unknown | VN, BC-facts, BC-S14, BA 3.2 |
| PAT-11 | Receive both a texture path and a numeric item ID in one variable, and create only one of an image and an item renderer with $v > 'a'/$v > 0. For a runtime string, choose by whether the first 9 bytes are textures/. | working pack | - | AP 4.5 and 4.7 |
| PAT-12 | Add a slot that is off by default to the vanilla button template so that only the buttons that need it get a hover tooltip. Use the MOD-10 example as is. | working pack | - | AP 4.8 |
Proposed rules
These proposals are not merged into the adopted rules yet. Check the evidence before using them.
| ID | Rule | Level | Evidence environment | Source |
|---|---|---|---|---|
| PAT-13 | A 2D layout made with keys. For each vertical factory item, (1) turn on the left and right spacers of a horizontal stack with keys in the button string to push the button sideways, and (2) put the picture inside a zero-height panel and let a sizer that can be turned off by a key decide the item height, and the item after one carrying a "no height" key is placed on the same row. The server sends only an ordinary button list and the selection numbers do not change. Give horizontal spacers together so that the press areas of overlapping items do not overlap. | working pack, inferred | - | SLB chapter 4, GrimUI key document |
| PAT-14 | A chest-style server form recipe: choose the size by a title flag (HOST-34), and generate only the per-size template in use with a global variable ignored. Make the cells with grid + collection_name: form_buttons, and per cell branch between an image and inventory_item_renderer with '%.8s' = 'textures' (PAT-11). Send quantity and durability in a fixed-width header in the button text (EXP-11), and put a tooltip on hover (INP-28). Put numeric IDs in with (#v - 0). | working pack | - | Chest-UI |
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
repo-guide | JSON UI comprehensive guide (this repository) (guide/) | This project's material | 2026-11-13 | |
private-research | Private research (-) | - | 2026-11-13 |