Skip to main content

[Failed] Inferring numeric item IDs (aux) from the Script API

The JSON UI inventory_item_renderer draws an item from #item_id_aux = numeric item ID * 65536 + data value (ANI-06). Enchant glint adds 32768. Unlike drawing from a texture path, blocks show in 3D and glint shows (research screen section 8.1).

For an icon fixed in the resource pack, write the item identifier in #item_name of the property_bag instead of a number (ANI-51). This applies only to a name written literally in the definition JSON, not to a name set by a variable or a binding. The name-to-number rewrite runs once over the packs' definition JSON when a world is entered, and a UI reload or /reload in the world does not run it again. The renderer does not read #item_name. So it cannot be used for an item a script picks at run time (a form button texture, for example); send the number this page covers instead.

The problem is that a script has no way to know this number. This page covers how the numeric IDs are laid out (section 2), what a behavior pack script can compute from that (section 3), and ways to draw items without computing numbers, by placing the real item in an inventory slot and letting the engine draw it (section 4).

The rules were checked on 1.26.63 mobile with the probe add-on (section 5).

1. The Script API has no numeric ID​

The typings of @minecraft/server 2.11.0 (stable), 2.12.0-beta.1.26.63-stable and 2.13.0-beta.1.26.70-preview.24 were checked.

APIWhat it gives
ItemTypeid (string), localizationKey
ItemTypesget(id), getAll()
BlockTypeid, localizationKey
BlockTypesget(id), getAll()
ItemStackThe constructor is (itemType, amount). There is no data value member
BlockPermutation.getItemStack(), Block.getItemStack(amount, withData)Return an ItemStack. withData is block entity data
  • No member returns a numeric ID, runtime ID, legacy ID or aux.
  • ActionFormData.button(text, iconPath) in @minecraft/server-ui takes only a texture path. There is no overload that draws an icon from an item type.
  • The only inputs a script has are the lists from ItemTypes.getAll() and BlockTypes.getAll(). Vanilla numbers must be put into the script as a table per version.

2. Numeric ID layout (1.26.63)​

The drawn number is the network runtime ID in the item registry built by whoever opened the world (a dedicated server, or the client hosting the world). The item list of a 1.26.0 world captured with ProxyPass matches the Chest-UI 26.20 table for 1813 of 1824 shared names, and custom items and blocks drew from the runtime IDs * 65536 that a Dragonfly server gave them (Ore UI loading research, 1.26.52 Windows).

TargetNumeric ID
Vanilla items and blocksThe runtime ID in that version's server data. Items at 853 or above add C, the custom item count of all packs
Custom items853 + k, where k (from 0) is the place after lining up behavior packs in stack order and the item files inside each pack in case-insensitive path order
Custom blocksBehavior packs in stack order take numbers downward from -9745 one by one, earlier pack first. Inside a pack, reverse path order. For one pack with n blocks, the j-th in path order (from 0) is -9745 - (n - 1 - j)

2.1 Vanilla​

  • On 1.26.6x the vanilla numbers match server/world/vanilla_items.nbt that Dragonfly added in its 1.26.60 support commit (2026-10-28, gophertunnel 1.63.0, 2080 items, -1251 to 884).
  • The point P where custom items go in is 853 (red shrub). Vanilla numbers before it do not shift.
  • 1.26.60 added frostbite_spawn_egg at 791, so numbers from 792 on are 1 higher than on 26.50. Sending apple by its 26.50 number (882 + 1 custom item = 883) drew a wind charge on 1.26.63.
  • Vanilla numbers change with each version (diamond is 335 in 26.30 and 306 in 26.40, C-33). A script cannot read the game version, so the vanilla table matches the one version the add-on targets.
  • There is a record that C has a cap: past 1569 custom items, nothing shifts further (Bedrock Wiki 26.50, not tested).

Numbers 840 to 903 in a world with 5 custom items. Custom items sit at 853 to 857, the shifted vanilla items follow from the red shrub at 858, and apple is at 888 (883 + 5)

2.2 Order of custom items​

Inside a pack, item files are sorted by path, ignoring case (the same result as JavaScript localeCompare). Why it is not another order:

  • Not identifier order. z_first.json, whose identifier is aux_probe_a, came last.
  • Not file name order with subfolders first. sub/k_sub.json came between m_mid.json and z_first.json.
  • Not byte order. B_upper.json came after aux_probe_test.json, and m_mid.json came before m-dash.json (in bytes - comes before _). Only this one pair separates _ and -.
  • Digits are not read as numbers. n10.json came before n9.json.

Numbers 840 to 903 with two packs. The extra pack at 853 to 854, then the probe pack at 855 to 863 in the order blue (a_last), spyglass (aux_probe_test), orange (B_upper), lime (m_mid), purple (m-dash), magenta (n10), cyan (n9), yellow (sub/k_sub), red (z_first)

2.3 Several behavior packs​

The order between packs is the behavior pack stack order. Items and blocks use the same pack order.

  • Paths are not sorted together across packs. By path, the extra pack's c_extra.json would come right after the probe pack's aux_probe_test.json, but the extra pack's 2 items came as one block before the probe pack.
  • Swapping the two packs in the active list swaps the blocks of both items and blocks. The order inside each pack and the vanilla shift C stay the same.

Numbers 840 to 903 after the swap. The 9 probe pack items at 853 to 861, the 2 extra pack items at 862 to 863, red shrub at 864

Numbers -9776 to -9713 after the swap. Gold at -9745, emerald at -9746, diamond at -9747 (probe pack), lapis at -9748 (extra pack). Before the swap, lapis was at -9745

2.4 Custom blocks​

  • Custom blocks go downward from -9745 (= -10000 + 255) and draw in 3D. Just below the lowest vanilla number (-1278 to -1252) was empty.
  • Inside a pack, reverse path order. z_first.json, last in path order, got -9745. This differs from identifier order (a, b, c).
  • Custom blocks do not shift the item range. Their block items are in ItemTypes.getAll(), but C counts custom items only.

Numbers -9776 to -9713 with two packs, before the swap. Lapis at -9745 (extra pack), gold at -9746 (z_first), emerald at -9747 (m_mid), diamond at -9748 (a_last)

2.5 What getAll() gives​

  • It gives the right custom item count C. Count the entries that are not minecraft: and not custom blocks.
  • Its order cannot be trusted. Two worlds with the same registry order got ItemTypes.getAll() orders a, d, c, test, b and c, a, d, test, b.
  • Discord (2026-07-09) has a report that a world with every free Marketplace add-on counted 1518, but the real shift was 1560. C with very many custom items was not checked.

Menu of the first world, with the 5 custom items in the order a, d, c, test, b

Menu of the second world with the same registry order, in the order c, a, d, test, b

3. What a script can do​

TargetFrom a scriptHow
Vanilla items and blocksPossibleThe target version's vanilla table + C counted with ItemTypes.getAll() (only for 853 and up)
The pack's own custom items and blocksOnly when the pack is firstA table built from file paths at build time. When other packs come first, it shifts by their item and block counts
Other packs' custom items and blocksNot possibleA script cannot know which pack an item belongs to, the pack order, or the file paths

A script can read neither the file paths nor the pack order, and the getAll() order cannot be trusted. So the numbers of custom items and blocks cannot be settled when other packs are in use.

A practical setup:

  1. Draw vanilla items and blocks from aux numbers (3D, glint).
  2. Draw the pack's own custom items and blocks from texture paths in its own resource pack. Textures do not depend on the pack order.
  3. Use a custom number table only where the pack can be fixed to come first.

3.1 Where to use it​

Computing numbers in a behavior pack script and sending them to the UI is not recommended for distributed add-ons. An add-on cannot know which game version or which other packs it runs with. The vanilla table goes stale with every game update, and custom numbers shift when another pack comes first. A wrong number draws a different item, not an empty cell.

On a private server it is the best method. The operator fixes the game version, the pack list and the stack order, so a table that matches once keeps matching. It does not touch the player inventory, works in server forms and the HUD alike, and has no limit on the icon count. Rebuild the vanilla table when the server updates, and the custom number table when the pack setup changes. A custom server that sends the item list itself (Dragonfly and others) assigns the numbers, so it needs no inference at all (HUD item icons section 3).

4. Drawing from inventory slots without numbers​

When a real item sits in an inventory slot such as the player hotbar or a chest, the client fills #item_id_aux of that slot itself. No number is computed, so vanilla items, custom items and other packs' items all draw correctly, with 3D and glint. The cost is borrowing player slots for a moment, or using a container screen.

MethodScreenSlots usedProperties
Back up slots, then fill themHUDAs many as shown, for as long as shownIt moves player items, so a backup and restore mismatch can lose them. Being measured (section 4.4)
Several empty slots + lock-checked freeze (section 4.1)HUDAs many as shown, for 1 tickRight even when cleared after 1 tick. The most reliable
One slot + count-checked freeze (section 4.2)HUD1 slot, 3 ticks per iconRight at 3 ticks apart. Stackable items only
Entity inventory screenContainer screen0 player slotsThe engine draws the entity slots, so there is no timing issue. Covered in the InvUI plan

What does not work:

AttemptWhy not
Reading inventory collections in a server form screenWith an item in slot 17, hotbar_items, combined_hotbar_and_inventory_items and inventory_items all read empty. Borrowing slots works only in the HUD
Reading bundle contents in the HUDFor a bundle in the hotbar, #bundle_item_renderer_data and #item_storage_current_amount were empty. Only the bundle icon shows
Drawing an item entity with live_horse_rendererThe item entity cell was empty. Players and armor stands drew the same way (#entity_id set to the raw button text)
Using an entity holding the item as the iconAn invisible armor stand showed only the held item, but the held pose differs per item (on an entity with only a hand bone, flat items show as a side-on line; custom held poses)

4.1 Several empty slots + lock-checked freeze​

  1. The script puts display items into empty main inventory slots (for example 9 to 14) all at once. Display items get lockMode = slot, keepOnDeath = true and a recognizable nameTag.
  2. On the next tick it sends one title. The HUD panel becomes visible with that title.
  3. The HUD reads hotbar_items at collection_index 9 to 35. A hidden data panel per cell freezes #item_id_aux and #item_lock_in_slot at the moment it becomes visible, with binding_condition: "visibility_changed".
  4. The icon reads the data panel's values through source_control_name and resolve_sibling_scope: true, and shows only when the frozen #item_lock_in_slot is true.
  5. The script clears the slots. The frozen icons stay while the title is up.
"locked": {
"type": "panel", "size": [ 18, 18 ], "collection_index": "$slot",
"controls": [
{
"data": {
"type": "panel", "size": [ 0, 0 ],
"bindings": [
{ "binding_type": "collection", "binding_collection_name": "hotbar_items", "binding_name": "#item_id_aux", "binding_condition": "visibility_changed" },
{ "binding_type": "collection", "binding_collection_name": "hotbar_items", "binding_name": "#item_lock_in_slot", "binding_condition": "visibility_changed" }
]
}
},
{
"icon": {
"type": "custom", "renderer": "inventory_item_renderer", "size": [ 16, 16 ], "layer": 2,
"property_bag": { "#item_id_aux": 0 },
"bindings": [
{ "binding_type": "view", "source_control_name": "data", "resolve_sibling_scope": true, "source_property_name": "#item_id_aux", "target_property_name": "#item_id_aux" },
{ "binding_type": "view", "source_control_name": "data", "resolve_sibling_scope": true, "source_property_name": "#item_lock_in_slot", "target_property_name": "#visible" }
]
}
}
]
}

Put this panel inside a stack panel with collection_name: "hotbar_items". The player's own items are not locked, so if the title arrives late and the slot is already empty or holds another item, the icon just stays hidden and no wrong icon is frozen.

4.2 One slot + count-checked freeze​

Items go into one slot in turn, and the icons freeze one at a time. The k-th item (from 0) goes in as k + 2 items, and the k-th frozen cell shows only when the count at that moment is k + 2. The frozen cells take their step from the length of the title text (ixc:a, ixc:aa, ...). The title is sent on the tick after the item goes in.

  • #inventory_stack_count is the count label text, not a number. Strip the format codes before comparing, as in (((#inventory_stack_count - '§r') - '§f') = 3).
  • Counts start at 2. In this HUD setup (hotbar_items), a slot with a count of 1 did not match an empty string even after the format codes were removed.
  • A chest screen (container_items) gave a different result. #inventory_stack_count was an empty string for a count of 1 and for an empty slot, and comparing without removing format codes, (#inventory_stack_count = ''), was true. Counts of 2 and 64 gave 2 and 64 and false (measured, mobile, 2026-11-16). Whether the HUD mismatch comes from the screen or from the expression that removes format codes was not isolated {unverified}. On the HUD, do not use a count of 1.
  • The count check is required. Freezing on the title step alone shifted by one cell at 1 tick apart and froze a different icon. With the count check, the same gap gives an empty cell instead of a wrong icon.
  • Items that stack to 1, such as swords and tools, cannot change their count, so they cannot be used.

4.3 Device speed and risks​

  • With both methods, a late freeze gives an empty cell and never a wrong icon. Only the empty icons need a retry.
  • In section 4.1, ticks only decide when the slots may be cleared. Section 4.2 needs a gap per icon, so failures grow on slow devices.
  • The borrowed slots must be empty at the start. Display items (told apart by name tag) are cleared on join.
  • Both methods are HUD only, and a player who opens the inventory screen while slots are borrowed sees the display items.

4.4 Test add-on​

The methods of section 4 and the attempts that do not work are collected in one add-on (Item Icon Slots). The icons are diamond, chest, golden apple, netherite sword and the add-on's 2 custom items (red and blue wool pictures). The one-slot method uses 12 stackable items.

MenuWhat it does
HUD: back up slots 9-14 and fill themBacks up the items in slots 9 to 14, puts display items in, shows them for 5 seconds and restores
HUD: 6 empty slots, lock check, clear after 1 tick / 10 ticksSection 4.1. The top row (Frozen) is the frozen icons, the bottom row (Live) the current slots
HUD: 1 slot, count check, 3 ticks apart / 1 tick apartSection 4.2
HUD: 1 slot, no check, 1 tick apartSection 4.2 without the count check
HUD: bundle contentsPuts a bundle holding a diamond and a red item into the 9th hotbar slot and draws its contents cell and stored amount
Form: read inventory slot 17Puts a diamond in slot 17 and reads four inventory collection rows in a server form
Form: entities holding itemsAn item entity, an armor stand, an invisible armor stand and an entity with only a hand bone float overhead with a diamond, a chest and a red item. The server form draws them with live_horse_renderer. The last row is the player
Download: [bedrock-research]item-icon-slots_v1.1.0.mcaddon
[bedrock-research]item-icon-slots v1.1.0 · 10.8 KB · Test item bwiki:item_icon_slots_test
  1. In a new world, turn on the behavior pack whose name starts with [bedrock-research]item-icon-slots-bp. The resource pack turns on with it as a dependency.
  2. Take "Item Icon Slots" (bundle picture) from the end of the Items category of the creative inventory. /give @s bwiki:item_icon_slots_test works too.
  3. Use the item to open the menu. /scriptevent bwiki:item_icon_slots opens it too. HUD menus show at the top middle of the screen after the menu closes.
  • Menus that need empty slots say so in chat and do not start when the slots are full. The 6-slot menus use slots 9 to 14 (the left 6 of the first main inventory row), the one-slot and form menus use slot 17, and the bundle menu uses the 9th hotbar slot.
  • Only the backup menu uses full slots as they are. The backup is kept in script memory and in a player dynamic property. If the player leaves the world before the restore, the next join restores from the dynamic property, which keeps only the type, amount, name, lore, durability and enchantments.
  • The server form part can be turned on in the same world as the other server form examples. Its form titles are §b§wis:slot and §b§wis:ent, and its server_form.json differs only in the router line (JSON UI optimization section 9, measured).
  • The HUD part hides every HUD title that starts with ix, whichever pack sent it (hud_screen.json). Do not turn it on together with other packs that use HUD titles starting with ix.
  • The text on screen is English.

5. Probe add-on​

The probe registers custom items and blocks and draws 64 numeric IDs with the item renderer, each labeled with its number. The colors show what sits at each number. The menu offers 840 to 903, -1278 to -1215, -9776 to -9713, or a typed start number. The body of the first menu lists the custom items and blocks that ItemTypes.getAll() and BlockTypes.getAll() returned, in that order.

PackFilePicture
Probeitems/a_last.jsonBlue wool
Probeitems/aux_probe_test.jsonSpyglass (launcher item)
Probeitems/B_upper.jsonOrange wool
Probeitems/m_mid.jsonLime wool
Probeitems/m-dash.jsonPurple wool
Probeitems/n10.jsonMagenta wool
Probeitems/n9.jsonCyan wool
Probeitems/sub/k_sub.jsonYellow wool
Probeitems/z_first.jsonRed wool
Probeblocks/a_last.json, blocks/m_mid.json, blocks/z_first.jsonDiamond, emerald, gold block
Extraitems/c_extra.json, items/y_extra.jsonPink, light blue wool
Extrablocks/c_block.jsonLapis block

File names and identifiers (aux_probe_a to aux_probe_h and so on) are deliberately in different orders.

Download: [bedrock-research]item-aux-probe_v1.2.0.mcaddon
[bedrock-research]item-aux-probe v1.2.0 · 8.6 KB · Test item bwiki:aux_probe_test
Download: [bedrock-research]item-aux-probe-extra_v1.0.0.mcaddon
[bedrock-research]item-aux-probe-extra v1.0.0 · 2.6 KB
  1. Open the file to import it (on mobile, tap the file and open it with Minecraft). In a new world, turn on the behavior pack whose name starts with [bedrock-research]item-aux-probe-bp. The resource pack turns on with it as a dependency, and no experimental toggle is needed.
  2. Take "Item Aux Probe" (spyglass) from the end of the Items category of the creative inventory. /give @s bwiki:aux_probe_test works too.
  3. Use the item to open the menu. /scriptevent bwiki:aux_probe opens it too.
  • Turn on the extra pack (the one whose name starts with [bedrock-research]item-aux-probe-extra-bp) together with the probe to see the order with several packs. On its own it has no screen to open. Swapping the two packs in the active list shows the difference in section 2.3.
  • Custom items of other test add-ons also enter the registry, so turn them off.
  • It can be turned on in the same world as the other server form examples. Its form title is §b§wap:scan, and its server_form.json differs only in the router line (JSON UI optimization section 9, measured). Because of the registry issue above, turn other add-ons off when measuring numeric IDs.
  • The text on screen is English.
IDPageContent
ANI-06Images and animationThe item renderer and #item_id_aux
EXP-16Expressions(#v - 0) to turn a string into a number
HOST-17Screen hosts and dataChest slot numbers and the shifting range
C-33Conflict tableStable numeric ID range
Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13
repo-chest-uiChest-UI analysis (this repository) (chest-ui/)This project's material2026-11-13
chest-uiChest-UICC BY 4.0 (confirmed in the repository License file)115d95c2026-11-13
bedrock-wikiBedrock WikiCC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository)0930b392026-11-13
repo-ore-ui-loadingOre UI loading research (this repository) (ore-ui-loading/)This project's material2026-11-13
private-researchPrivate research (-)-2026-11-13