Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Reading tags in custom loot evaluation

LootFunctionEvent and LootConditionEvent carry tags: &dyn Tags alongside their owned context and candidate snapshots. This is a read-only view of the merged tags used by the current loot evaluator, not a full Host.

Resolve an Identifier with event.tags.key(&id), retain the resulting TagKey, and call is_in_tag(item, tag) for item membership. items(tag), blocks(tag) and fluids(tag) return ordered members by key. There is no operation to enumerate every tag. Unknown tags return Some(false) or Some(Vec::new()); unavailable key mappings return None. A retained key keeps its identity across reloads, but its members are read from the current evaluation's tables.

The same Tags resource crosses Wire for native and wasm callbacks. Neither callback gains a mutable game host or an opportunity to change tags. No tag snapshot is copied when a loot hook has no subscribers.

This is deliberately only tag access. The broader typed read-only loot-context contract, including which optional entity, tool, block and other parameters are available for each evaluation kind, is separate work tracked in #2647.