Truncate tags command clipboard text to 1000 entries #1546
+16
−2
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.
This PR fixes #1543 by truncating the amount of lines in the copy-to-clipboard text of the
/neoforge tags
command to 1000 entries (plus two explanatory lines at the start and end), as I suggested in my comment on that issue.Tested by modifying the
list
subcommand temporarily to have 2000+ dummy entries (adding to the count and usingStream.concat
), and it works.As explained in the comment, the 1,000 entries limit was chosen by seeing how many entries of 32 characters length fit into a limit of 32,767 characters (as that is the default limit for strings in
FriendlyByteBuf
) and rounding down to the nearest hundreds to account for differences in tag lengths. That should be plenty enough for most development uses.This artificially constrains the clipboard text to 1000 entries, even if more can fit inside, which would render it less useful for modpacks who go above the limit but currently do not run into the string-length limit of
FriendlyByteBuf
.We could perhaps consider adding a new subcommand to
/neoforge dump
which exports the list of tags for registries (or elements in a tag, or tags of an element). Should that be added, we may also remove the functionality of the copy-on-clipboard for/neoforge tags
, and perhaps even have it instead give the appropriate/neoforge dump
command to the user with arguments filled in.