BedrockShortName

public final class BedrockShortName

Generates short, opaque, deterministic identifiers for the Bedrock pack's internal file paths and Geyser mapping identifiers.

Why this exists

Bedrock resource packs warn ("This will cause problems on some Bedrock platforms") when any file inside the pack has a path of 80+ chars. The previous naming scheme textures/items/<namespace>__<longJavaPath>.png routinely produced 100+ char paths because Java item paths embedded the full plugin/model/bone hierarchy (e.g. freeminecraftmodels__fmm_craftenmine_basic_item_pack_velocity_enhancer_mk2_crossbow_charged_arrow.png = 116 chars). At a few hundred such files per pack, the warning floods the Geyser log and risks rejection on consoles/mobile clients.

What this does

Replaces those long human-readable stems with an 8-char hex hash derived from the source identifier. The hash is:
  • Deterministic — same input always produces same output, so Bedrock client caches stay valid across re-merges and so identifiers on the proxy match identifiers on the backends.
  • Short — 8 hex chars (32-bit prefix of SHA-256) keeps file paths well under 80 chars and Geyser mapping JSON compact.
  • Opaque — reveals nothing about the source plugin, model name, or bone name. The user explicitly does not want pack inspection to trivially identify the source (e.g. "fmm" prefix would be a dead giveaway).
  • Collision-resistant in practice — 32-bit space holds 4.3 billion unique IDs; birthday-paradox 1%-collision threshold sits around ~10k mappings, well above any realistic pack size.

Hash recipe

SHA-256 of the input UTF-8 bytes, then hex-encode the first 4 bytes. Lower-case alphanumeric, always 8 chars, suitable for use as a file-path stem or as the path-segment of a Bedrock identifier.

Namespace

BEDROCK_NAMESPACE is the single-letter Bedrock identifier namespace used for everything RSPM emits. Picked for length, not branding; one letter keeps the namespace:path identifier as short as possible (e.g. r:a7b3c1d8 = 10 chars). The letter itself doesn't decode to anything meaningful — deliberately not "f" (FMM), "rspm" or similar.

Properties

Link copied to clipboard
public final static String BEDROCK_NAMESPACE
One-letter Bedrock identifier namespace for all RSPM-generated attachables and item mappings.

Functions

Link copied to clipboard
public static String bedrockIdentifier(String shortName)
Builds a full Bedrock identifier from a short name: "r:<name>".
Link copied to clipboard
public static String forBaseMapping(String modelRef, String baseItem)
Stable short name keyed by the (model, base-item) pair, with no predicate component.
public static String forBaseMapping(String modelRef, String baseItem, String predicateSignature)
Stable short name keyed by the (model, base-item, predicate-signature) triple.
Link copied to clipboard
public static String forModel(String modelRef)
Stable short name keyed by a single source string.
Link copied to clipboard
public static String shortHash(String input)
Core hash: SHA-256, first 4 bytes encoded as 8 chars, lower-case.