Skip to main content

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.

IDRuleLevelEvidence environmentSource
PAT-01The 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-02For 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)unknownBC-S1, BC-S7, BC 4.1-(3) and (4), VN server_form.json:211-246
PAT-03Put 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-04Instead of visible, gate with a factory that computes #collection_length and creates nothing when it is 0.measuredunknownBC-S11, BC-S8
PAT-05Carry 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-06Stack 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-07Put the tab content inside each toggle's checked state control of a radio toggle group, and give all 8 states and the toggle mappings.measuredunknownBC-S4, BC chapter 5, BC-samples tabbed.document.json
PAT-08Place 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-09Place 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-10Give 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, measuredunknownVN, BC-facts, BC-S14, BA 3.2
PAT-11Receive 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-12Add 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.

IDRuleLevelEvidence environmentSource
PAT-13A 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-14A 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
Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13
private-researchPrivate research (-)-2026-11-13