Ported NeoForge 1.21 to NeoForge 1.21.5

package net.mattias.pedestals.datagen;

import net.mattias.pedestals.Pedestals; import net.mattias.pedestals.core.Constants; import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.loot.LootTableProvider; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.common.data.BlockTagsProvider; import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.neoforged.neoforge.data.event.GatherDataEvent;

import java.util.Collections; import java.util.List; import java.util.concurrent.CompletableFuture;

@EventBusSubscriber(modid = Constants.MOD_ID, bus = EventBusSubscriber.Bus.MOD) public class DataGenerator { @SubscribeEvent public static void gatherData(GatherDataEvent event) { net.minecraft.data.DataGenerator generator = event.getGenerator(); PackOutput packOutput = generator.getPackOutput(); ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();

    if (event.includeClient()) {
        generator.addProvider(event.includeClient(), new ModBlockStateProvider(packOutput, existingFileHelper));
    }


    generator.addProvider(event.includeServer(), new ModRecipeProvider(packOutput, lookupProvider));
    generator.addProvider(event.includeServer(), new LootTableProvider(packOutput, Collections.emptySet(),
            List.of(new LootTableProvider.SubProviderEntry(ModBlockLootTableProvider::new, LootContextParamSets.BLOCK)), lookupProvider));

    BlockTagsProvider blockTagsProvider = new ModBlockTagProvider(packOutput, lookupProvider, existingFileHelper);
    generator.addProvider(event.includeServer(), blockTagsProvider);;
}
} Cannot resolve symbol 'ExistingFileHelper' Cannot resolve symbol 'ExistingFileHelper' Cannot resolve method 'getExistingFileHelper' in 'GatherDataEvent' Cannot resolve method 'includeClient' in 'GatherDataEvent' Cannot resolve method 'includeClient' in 'GatherDataEvent' Cannot resolve method 'includeServer' in 'GatherDataEvent' Cannot resolve method 'includeServer' in 'GatherDataEvent' Cannot resolve method 'includeServer' in 'GatherDataEvent'

package net.mattias.pedestals.datagen;

import net.mattias.pedestals.core.registry.ModBlocks; import net.mattias.pedestals.core.util.PedestalVariant; import net.mattias.pedestals.core.util.PedestalVariants; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.data.loot.BlockLootSubProvider; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.level.block.Block;

import java.util.Set;

public class ModBlockLootTableProvider extends BlockLootSubProvider { public ModBlockLootTableProvider(HolderLookup.Provider provider) { super(Set.of(), FeatureFlags.REGISTRY.allFlags(), provider); }

@Override
protected void generate() {
    this.dropSelf(ModBlocks.PEDESTAL.get());
    for (PedestalVariant variant : PedestalVariants.VARIANTS) {
        this.dropSelf(ModBlocks.REGISTERED_VARIANT_MAP.get(variant).get());
    }
}

@Override
protected Iterable<Block> getKnownBlocks() {
    return () -> ModBlocks.BLOCKS.getEntries().stream().map(Holder::value).iterator();
}
}

package net.mattias.pedestals.datagen;

import net.mattias.pedestals.core.Constants; import net.mattias.pedestals.core.registry.ModBlocks; import net.mattias.pedestals.core.util.PedestalVariant; import net.mattias.pedestals.core.util.PedestalVariants; import net.minecraft.data.PackOutput; import net.minecraft.world.level.block.Block; import net.neoforged.neoforge.client.model.generators.BlockStateProvider; import net.neoforged.neoforge.client.model.generators.ConfiguredModel; import net.neoforged.neoforge.client.model.generators.ModelFile; import net.neoforged.neoforge.common.data.ExistingFileHelper;

public class ModBlockStateProvider extends BlockStateProvider {

public ModBlockStateProvider(PackOutput output, ExistingFileHelper existingFileHelper) {
    super(output, Constants.MOD_ID, existingFileHelper);
}

@Override
protected void registerStatesAndModels() {
    pedestalBlock(ModBlocks.PEDESTAL.get(), "pedestal");
    for (PedestalVariant variant : PedestalVariants.VARIANTS) {
        pedestalBlock(ModBlocks.REGISTERED_VARIANT_MAP.get(variant).get(), variant.registryName());
    }
}

private void pedestalBlock(Block block, String name) {
    getVariantBuilder(block).forAllStates(state ->
            ConfiguredModel.builder()
                    .modelFile(new ModelFile.UncheckedModelFile(modLoc("block/" + name)))
                    .build());

    itemModels().withExistingParent(name, modLoc("block/" + name));
}
} Cannot resolve symbol 'BlockStateProvider' Cannot resolve symbol 'ConfiguredModel' Cannot resolve symbol 'ModelFile' Cannot resolve symbol 'ExistingFileHelper' Cannot resolve symbol 'BlockStateProvider' Cannot resolve symbol 'ExistingFileHelper' Cannot resolve method 'super' in 'ModBlockStateProvider' Cannot resolve method 'getVariantBuilder' in 'ModBlockStateProvider' Cannot resolve symbol 'ConfiguredModel' Cannot resolve symbol 'ModelFile' Cannot resolve method 'modLoc' in 'ModBlockStateProvider' Cannot resolve method 'itemModels' in 'ModBlockStateProvider' Cannot resolve method 'modLoc' in 'ModBlockStateProvider'

package net.mattias.pedestals.datagen;

import net.mattias.pedestals.core.Constants; import net.mattias.pedestals.core.registry.ModBlocks; import net.mattias.pedestals.core.util.PedestalVariant; import net.mattias.pedestals.core.util.PedestalVariants; import net.minecraft.core.HolderLookup; import net.minecraft.tags.BlockTags; import net.minecraft.world.level.block.Block; import net.neoforged.neoforge.common.Tags; import net.neoforged.neoforge.common.data.BlockTagsProvider; import net.neoforged.neoforge.common.data.ExistingFileHelper; import org.jetbrains.annotations.Nullable; import net.minecraft.data.PackOutput;

import java.util.concurrent.CompletableFuture;

public class ModBlockTagProvider extends BlockTagsProvider {

public ModBlockTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
    super(output, lookupProvider, Constants.MOD_ID, existingFileHelper);
}

@Override
protected void addTags(HolderLookup.Provider provider) {
    this.tag(BlockTags.MINEABLE_WITH_PICKAXE)
            .add(ModBlocks.PEDESTAL.get());

    this.tag(BlockTags.WOOL);

    for (PedestalVariant variant : PedestalVariants.VARIANTS) {
        Block block = ModBlocks.REGISTERED_VARIANT_MAP.get(variant).get();
        String name = variant.registryName();

        if (name.contains("wool")) {
            this.tag(BlockTags.WOOL).add(block);
        } else if (name.contains("soul")) {
            this.tag(BlockTags.MINEABLE_WITH_SHOVEL).add(block);
        } else if (name.contains("log") || name.contains("planks")) {
            this.tag(BlockTags.MINEABLE_WITH_AXE).add(block);
        } else {
            this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(block);
        }
    }


    this.tag(Tags.Blocks.NEEDS_WOOD_TOOL)
            .add(ModBlocks.PEDESTAL.get());
    for (PedestalVariant variant : PedestalVariants.VARIANTS) {
        this.tag(Tags.Blocks.NEEDS_WOOD_TOOL)
                .add(ModBlocks.REGISTERED_VARIANT_MAP.get(variant).get());
    }





    // this.tag(BlockTags.NEEDS_DIAMOND_TOOL)
    //        .add(ModBlocks.OBSIDIAN_PEDESTAL.get(), ModBlocks.CRYING_OBSIDIAN_PEDESTAL.get());
}
} Cannot resolve symbol 'ExistingFileHelper' Cannot resolve symbol 'ExistingFileHelper' Expected 3 arguments but found 4