MappedItemRegistry

public final class MappedItemRegistry

Accumulates Geyser definition entries across the generic Java→Bedrock pipeline. One instance per BedrockConversion.generate call.

Deduplication rules:

  • registerModelOnce returns true exactly once per unique bedrockSafeIdentifier — the orchestrator must write geometry/texture files only on the first call.
  • addMapping first dedupes by the tuple (baseItem, bedrockIdentifier, predicateShape) — two leaves under the same base item that resolve to the same model with the same predicate stack are skipped silently (Geyser rejects duplicate identifiers outright).
  • It then dedupes by Geyser's conflict identity (base item + emitted model + parsed predicate set). Geyser registers only one definition per identity and logs "both entries have the same predicates" for the rest, so emitting both would just pick a random winner at boot. Sources of such pairs: two merged packs claiming the same custom_model_data on one item with different models, duplicate thresholds/overrides inside a single pack, and dual-format packs whose modern items definition and legacy override describe the same matcher. Winner policy: a modern type=definition entry beats a type=legacy one (modern is what current Java clients render); between entries of the same type the last one wins, matching vanilla's pick among duplicate thresholds/overrides. Dropped pairs are reported via dedupNotes for the caller's one-line summary.

The safeIdentifier rule matches Rainbow's Rainbow.bedrockSafeIdentifier (Rainbow.java:18-20): ':' ->'.', '/' ->'_'. Used for filesystem paths and the item_texture.json lookup key.

Constructors

Link copied to clipboard
public void MappedItemRegistry()

Functions

Link copied to clipboard
public void addMapping(String baseItem, GeyserDefinitionEntry entry)
Link copied to clipboard
public List<String> dedupNotes()
Same-predicate pairs collapsed by addMapping, one human-readable note per pair, in emission order.
Link copied to clipboard
public Map<String, List<GeyserDefinitionEntry>> finalDefinitions()
Link copied to clipboard
public static String predicateShape(List<PredicateRecord> predicates)
Canonical, deterministic signature of a predicate stack.
Link copied to clipboard
public boolean registerModelOnce(String javaItemModel)
Link copied to clipboard
public static String safeIdentifier(String identifier)
Rainbow-style identifier sanitisation (mirrors Rainbow.bedrockSafeIdentifier): ':' becomes '.', '/' becomes '_'.
Link copied to clipboard
public int totalMappings()
Link copied to clipboard
public int uniqueModelsWritten()