Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate tags command clipboard text to 1000 entries #1546

Open
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from

Conversation

sciwhiz12
Copy link
Member

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 using Stream.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.

@sciwhiz12 sciwhiz12 added bug A bug or error 1.21.1 Targeted at Minecraft 1.21.1 labels Sep 15, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Sep 15, 2024

  • Publish PR to GitHub Packages

Last commit published: 9de94d91ac5323e515838f2e0155a3dc945d37ac.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #1546' // https://github.com/neoforged/NeoForge/pull/1546
        url 'https://prmaven.neoforged.net/NeoForge/pr1546'
        content {
            includeModule('net.neoforged', 'neoforge')
            includeModule('net.neoforged', 'testframework')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr1546.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1546
cd NeoForge-pr1546
curl -L https://prmaven.neoforged.net/NeoForge/pr1546/net/neoforged/neoforge/21.1.56-pr-1546-1.21.1-GH-1543-tags-command-clipboard-truncation/mdk-pr1546.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

@HenryLoenwind
Copy link
Contributor

One thought: Does this really need to run as a server command? Those registries are synced to the client, aren't they?

@lukebemish
Copy link
Contributor

Not necessarily -- afaik that command dumps tags for any registry, including server only ones? Registries can have tags and not be synced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.1 Targeted at Minecraft 1.21.1 bug A bug or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running command /neoforge tags <registry> list could kick player when there are too many tags
3 participants