Data generation: Adding a vanilla tag to a modded tag without also creating a builder for that vanilla tag causes an exception
FoxSamu opened this issue ยท 1 comments
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.