Skip to content

Simplify item ID resolution to drop module-prefixed lookup#328

Open
Travja wants to merge 2 commits into
devfrom
split/03-item-id-resolution
Open

Simplify item ID resolution to drop module-prefixed lookup#328
Travja wants to merge 2 commits into
devfrom
split/03-item-id-resolution

Conversation

@Travja

@Travja Travja commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Split out of #320 (piece 3/12, independent).

DivinityProvider previously namespaced item IDs by their owning module (e.g. custom_items:foobar) when resolving items by ItemStack or ID string. Since item IDs are unique across modules in practice, this indirection added complexity without a real need; getItem()/getID() now resolve by plain item ID.

Note for reviewers: this also drops the DivinityProviderTest cases that covered the namespaced-lookup behavior (getItem_namespacedIdIncludesModule, getItem_itemStackUsesStoredModule), since that behavior no longer exists. Please confirm no code outside this diff still depends on module-prefixed IDs before merging.

Backward compatibility

getItem(String) already parses the legacy "module:id" namespaced form unchanged (untouched by this diff), so any stored/external reference captured via the old getID() format still resolves correctly. isCustomItemOfId didn't have an equivalent fallback — added one so it still recognizes the namespaced form when plain-ID equality doesn't match, instead of always returning false for legacy callers.

claude added 2 commits July 23, 2026 04:24
DivinityProvider previously namespaced item IDs by their owning
module (e.g. "custom_items:foobar") when resolving items by
ItemStack or ID string. Since item IDs are unique across modules in
practice, this indirection added complexity without a real need;
getItem()/getID() now resolve by plain item ID.

Note for reviewers: this also drops the DivinityProviderTest cases
that covered the namespaced-lookup behavior
(getItem_namespacedIdIncludesModule, getItem_itemStackUsesStoredModule),
since that behavior no longer exists.
getItem(String) already parses the legacy "module:id" namespaced
form unchanged, so external references captured via the old getID()
format still resolve correctly. isCustomItemOfId did not have an
equivalent fallback: it moved straight to plain-ID equality, so any
caller still passing a namespaced id here (matching this method's
previous contract) would always get false after the simplification.
Fall back to the old module+split check when plain equality fails
and the id looks namespaced, so existing callers aren't silently
broken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants