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

[1.21] Fix data generator merge issue #1187

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

ApexModder
Copy link
Member

@ApexModder ApexModder commented Jun 25, 2024

When using the current DataGenerator system to generate built-in packs, you can easily run into Duplicate Provider errors.

This is due to how the system merges all providers down to a single larger provider in GatherDataEvent.
The current implementation ignores the id providers are registered with, which for most providers is no issue, but providers registered for built-in packs have the id prefixed with the packs id.

this PR aims to fix that issue by introducing a simple DataGenerator.merge method, which simply pulls the providers and their registered ids directly from the sub generators backing maps and moving them into the parents.


This pr also introduces a simple overload helper DataGenerator.getBuiltinDatapack, this is to allow generating modded builtin packs.

Original Discord message

@ApexModder ApexModder added enhancement New (or improvement to existing) feature or request 1.21 Targeted at Minecraft 1.21 labels Jun 25, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jun 25, 2024

  • Publish PR to GitHub Packages

Last commit published: 04fba14480e149f372568ebbaf08e3ed1405b3e6.

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 #1187' // https://github.com/neoforged/NeoForge/pull/1187
        url 'https://prmaven.neoforged.net/NeoForge/pr1187'
        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-pr1187.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1187
cd NeoForge-pr1187
curl -L https://prmaven.neoforged.net/NeoForge/pr1187/net/neoforged/neoforge/21.0.40-beta-pr-1187-pr-data-gen-issue/mdk-pr1187.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.

@Matyrobbrt Matyrobbrt added the bug A bug or error label Jun 26, 2024
@ApexModder ApexModder merged commit 6adc156 into neoforged:1.21.x Jul 2, 2024
7 checks passed
@ApexModder ApexModder deleted the pr/data-gen-issue branch July 2, 2024 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21 Targeted at Minecraft 1.21 bug A bug or error enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants