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

Adds a dump registry command #786

Merged
merged 23 commits into from
Apr 13, 2024

Conversation

TelepathicGrunt
Copy link
Contributor

@TelepathicGrunt TelepathicGrunt commented Apr 6, 2024

This adds a very useful command that can dump the entries of any registry into a file.
/neoforge registryDump <registry> <alphabeticalSort> <printNumericIds> Edit: see later comments for command change

The command has ability to autocomplete a registry name and display what is selectable. Works with worldgen registries as well. The options available are if to sort entries alphabetically or print numeric ids. If numeric id is true and alphabetical is false, the file will be sorted by the numeric id automatically.

The output of the command says what registry it was using and adds a clickable link that will open the file automatically for you.

Location of the file is put into the registry_dumps folder in the game directory (next to the configs and mods folder)

Images of how command looks and file outputs:


image


image
image
image


image
image


image
image


image
image


Errors thrown during file write would appear like this:
image

Closes #782

@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Apr 6, 2024

  • Publish PR to GitHub Packages

Last commit published: 3fa69007fb68dff0a2520ee6bf943d802af94b12.

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 #786' // https://github.com/neoforged/NeoForge/pull/786
        url 'https://prmaven.neoforged.net/NeoForge/pr786'
        content {
            includeModule('net.neoforged', 'testframework')
            includeModule('net.neoforged', 'neoforge')
        }
    }
}

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-pr786.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr786
cd NeoForge-pr786
curl -L https://prmaven.neoforged.net/NeoForge/pr786/net/neoforged/neoforge/20.4.250-pr-786-RegistryDumpCommand/mdk-pr786.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.

@Shadows-of-Fire Shadows-of-Fire added enhancement New (or improvement to existing) feature or request 1.20.4 Targeted at Minecraft 1.20.4 labels Apr 6, 2024
@Shadows-of-Fire
Copy link
Contributor

I would suggest sending the output files to folders by namespace, transforming minecraft_entity_type.txt to minecraft/entity_type.txt

@TelepathicGrunt
Copy link
Contributor Author

TelepathicGrunt commented Apr 6, 2024

image
image
image

@TelepathicGrunt
Copy link
Contributor Author

TelepathicGrunt commented Apr 6, 2024

Command is now /neoforge dump registry <registry> <alphabetical_sort> <print_numeric_ids> and will print to the game directory's dumps/registry folder. The registry's namespace is now a folder inside. And command is now level four Commands.LEVEL_OWNERS

@TelepathicGrunt TelepathicGrunt changed the title Adds a registryDump command Adds a dump registry command Apr 6, 2024
@TelepathicGrunt TelepathicGrunt marked this pull request as draft April 7, 2024 12:56
@TelepathicGrunt TelepathicGrunt marked this pull request as ready for review April 7, 2024 13:42
@Matyrobbrt Matyrobbrt enabled auto-merge (squash) April 13, 2024 07:11
@Matyrobbrt Matyrobbrt merged commit 70e1c7d into neoforged:1.20.x Apr 13, 2024
3 checks passed
ApexModder pushed a commit to ApexModder/NeoForge that referenced this pull request May 3, 2024
@TelepathicGrunt TelepathicGrunt deleted the RegistryDumpCommand branch June 12, 2024 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20.4 Targeted at Minecraft 1.20.4 enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add command to dump registries
3 participants