neoforged/NeoForge

[1.21.1] RunData crashes with Custom DamageTypes and DamageTypeTags

Closed this issue · 2 comments

Minecraft Version: 1.21.1

NeoForge Version: 21.1.73

Logs:
Main Resources folder no custom damage_type I wants genarate custom damage_type and DamgeTypeTag together

Main Resources folder with custom damage_type, and put genarated/resources/data/modid/damage_type to main/resources/data/modid/damage_type

Steps to Reproduce:

  1. Make a DamageTypeTagsProvider
public class DamageTagProvider extends DamageTypeTagsProvider {


  public DamageTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
    super(output, lookupProvider, Champions.MODID, existingFileHelper);
  }

  @Override
  protected void addTags(@NotNull HolderLookup.Provider provider) {
    this.tag(DamageTypeTags.IS_FIRE).add(ModDamageTypes.ENKINDLING_BULLET);
  }

}
  1. add Provider with GatherDataEvent
private void onGatherData(GatherDataEvent event) {
    var generator = event.getGenerator();
    var packOutput = generator.getPackOutput();
    var lookupProvider = event.getLookupProvider();
    var existingFileHelper = event.getExistingFileHelper();

    generator.addProvider(event.includeServer(), new ModGlobalLootModifierProvider(packOutput, lookupProvider));
    generator.addProvider(event.includeServer(), (DataProvider.Factory<DatapackBuiltinEntriesProvider>) (output) -> new DatapackBuiltinEntriesProvider(
      output, lookupProvider,
      new RegistrySetBuilder().add(Registries.DAMAGE_TYPE, ModDamageTypes::bootstrap),
      Set.of(Champions.MODID))
    );
    generator.addProvider(event.includeServer(), new ModAdvancementProvider(packOutput, lookupProvider, existingFileHelper, List.of(new ModAdvancementProvider.Generator())));
    // add tag generator
    generator.addProvider(event.includeServer(), new DamageTagProvider(packOutput, lookupProvider, existingFileHelper));

  }
  1. RunData task, and getting error: Couldn't define tag minecraft:is_fire as it is missing following references: champions:enkindling_bullet

Description of issue:
As title

You need to use lookup provider generated by dynamic registry provider for tag provider. This is not a bug

You need to use lookup provider generated by dynamic registry provider for tag provider. This is not a bug

ok, try