This repository was archived by the owner on Jul 20, 2026. It is now read-only.
fix: restore missing zprivate/replace function files#30
Merged
Conversation
zprivate/replace/ was deleted in 43b8bc5 (refactor: replace old datapack with the new modular structure) and never re-added when fd4d15c (Organize code) restored the rest of data/stringlib/. util/replace.mcfunction still calls stringlib:zprivate/replace/main and check_word_start_loop (plus reversed/ variants), which silently no-op when missing, so replace() always returned the original string unchanged and a return value of 0. Restored the 8 files from 43b8bc5^ (their last known-good state). Verified against a live 26.2 server via RCON: replace() now returns correct output and correct match count; find() unaffected (regression check).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
stringlib:util/replace(anddatalib:core/lib/string/replace, which wraps it) always returned the original string unchanged and a return value of 0, regardless of input.Root cause
zprivate/replace/(8 files) was deleted in 43b8bc5 ("refactor: replace old datapack with the new modular structure") along with the rest ofdata/stringlib/. When fd4d15c ("Organize code") later restoreddata/stringlib/—util/,zprivate/concat/,zprivate/find/,zprivate/split/, etc. —zprivate/replace/was not included.util/replace.mcfunctionstill callsstringlib:zprivate/replace/main,check_word_start_loop, and thereversed/equivalents. Minecraft'sfunctioncommand no-ops silently on an unknown function reference rather than erroring, so the datapack loaded without any "failed to load function" errors — the bug was silent.Fix
Restored the 8 files from
43b8bc5^(last known-good state, one commit before the deletion):Verification
Tested against a live 26.2 server via RCON, not just static analysis:
datalib:core/lib/string/replacewith string="Hello World", find="World", replace="Everyone" → output "Hello Everyone" (previously "Hello World", unchanged)zprivate/replace/again on the live server → bug reproduced ("Hello World"). Restored → fixed again ("Hello Everyone"). Confirms these files are the actual root cause, not a coincidental fix.stringlib:util/replacecalled directly with n=1 on "aXbXcX" → "a-bXcX" (only first match replaced,nparam works)stringlib:util/replacecalled directly with n=unset on "aXbXcX" → "a-b-c-", return value 3 (correct match count, was always 0 before)stringlib:util/findunaffected (regression check on separate function)Not in scope
datalib:core/lib/string/replace.mcfunctionitself does not propagate a return value fromstringlib:util/replace(its last line is atellraw, noreturn).stringlib:util/replace's own return value is correct after this fix. Leaving the wrapper as-is since it's unrelated to the reported bug — happy to open a separate PR if wanted.