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

Data generation: Adding a vanilla tag to a modded tag without also creating a builder for that vanilla tag causes an exception #4364

Open
FoxSamu opened this issue Jan 8, 2025 · 1 comment

Comments

@FoxSamu
Copy link
Contributor

FoxSamu commented Jan 8, 2025

I am working on a mod with several variants on fences, and it uses a block tag mod:fences (with a different namespace, of course, that I don't want to spoil here). It is a tag referring to all fences of all types, not just vanilla fences. So, it should contain an entry #minecraft:fences. Since I didn't add any blocks to minecraft:fences, the TagProvider then believes that the tag minecraft:fences does not exist, and throws an exception.

    // (mojmaps!!!)
    @Override
    protected void addTags(HolderLookup.Provider provider) {
        // other tags...

        // This call returns, but the generator will throw an exception later because of this
        tag(ModBlockTags.FENCES).addTag(BlockTags.FENCES);
    }

Upon running the data generator, this generates an IllegalArgumentException saying Couldn't define tag marl:fences as it is missing following references: #minecraft:fences.

A workaround is to create a tag builder for the vanilla tag simply by calling tag(BlockTags.FENCES) (as well as tag(ItemTags.FENCES) if you copy the block tag to an item tag). This is pretty unintuitive.

The problem lays in the vanilla TagsProvider. It supports providing a parent TagLookup, which could be provided by the generator for vanilla tags (such as VanillaBlockTagsProvider). Providing such a parent is currently unsupported by the Data Generation API.

@FoxSamu FoxSamu changed the title Data generation: Adding a vanilla tag to a modded tag without also adding entries to that vanilla tag causes an exception Data generation: Adding a vanilla tag to a modded tag without also creating a builder for that vanilla tag causes an exception Jan 8, 2025
@Linguardium
Copy link

Linguardium commented Jan 9, 2025

yarn below

definitely a bug since the javadocs mention that it is supposed to work for vanilla tags.

a workaround is to use the same method used for other mod tags and call forceAddTag instead of addTag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants