Skip to content

Commit

Permalink
🐛 Solve breaking changes in NeoForge 21.4.47-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Autovw committed Dec 29, 2024
1 parent 6687572 commit b557721
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.data.event.GatherDataEvent;

import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -37,16 +36,15 @@ public static void onGatherData(final GatherDataEvent.Client event)
DataGenerator generator = event.getGenerator();
PackOutput packOutput = generator.getPackOutput();
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
ExistingFileHelper helper = event.getExistingFileHelper();
ModBlockTagsProvider blockTagsProvider = new ModBlockTagsProvider(packOutput, lookupProvider, AdvancedNetherite.MOD_ID, helper);
ModBlockTagsProvider blockTagsProvider = new ModBlockTagsProvider(packOutput, lookupProvider, AdvancedNetherite.MOD_ID);

// server
event.addProvider(blockTagsProvider);
event.addProvider(new ModItemTagsProvider(packOutput, lookupProvider, blockTagsProvider.contentsGetter(), AdvancedNetherite.MOD_ID, helper));
event.addProvider(new ModEnchantmentTagsProvider(packOutput, lookupProvider, AdvancedNetherite.MOD_ID, helper));
event.addProvider(new ModItemTagsProvider(packOutput, lookupProvider, blockTagsProvider.contentsGetter(), AdvancedNetherite.MOD_ID));
event.addProvider(new ModEnchantmentTagsProvider(packOutput, lookupProvider, AdvancedNetherite.MOD_ID));
event.addProvider(new ModRecipeProvider.Runner(packOutput, lookupProvider));
event.addProvider(new ModLootTableProvider(packOutput, lookupProvider));
event.addProvider(new ModAdvancementProvider(packOutput, lookupProvider, helper));
event.addProvider(new ModAdvancementProvider(packOutput, lookupProvider));
event.addProvider(new ModLootModifierProvider(packOutput, lookupProvider, AdvancedNetherite.MOD_ID));

// client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.advancements.AdvancementProvider;
import net.minecraft.data.advancements.AdvancementSubProvider;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.common.data.AdvancementProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;

import java.util.List;
import java.util.concurrent.CompletableFuture;
Expand All @@ -23,15 +23,15 @@
*/
public class ModAdvancementProvider extends AdvancementProvider
{
public ModAdvancementProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> registries, ExistingFileHelper existingFileHelper)
public ModAdvancementProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> registries)
{
super(packOutput, registries, existingFileHelper, List.of(new ModNetherAdvancements()));
super(packOutput, registries, List.of(new ModNetherAdvancements()));
}

public static class ModNetherAdvancements implements AdvancementGenerator
public static class ModNetherAdvancements implements AdvancementSubProvider
{
@Override
public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolder> consumer, ExistingFileHelper fileHelper)
public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolder> consumer)
{
Advancement.Builder.advancement()
.parent(ResourceLocation.withDefaultNamespace("husbandry/obtain_netherite_hoe"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import net.minecraft.data.PackOutput;
import net.minecraft.tags.BlockTags;
import net.neoforged.neoforge.common.data.BlockTagsProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;

Expand All @@ -16,9 +14,9 @@
*/
public class ModBlockTagsProvider extends BlockTagsProvider
{
public ModBlockTagsProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider, String modId, @Nullable ExistingFileHelper existingFileHelper)
public ModBlockTagsProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider, String modId)
{
super(packOutput, lookupProvider, modId, existingFileHelper);
super(packOutput, lookupProvider, modId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.EnchantmentTagsProvider;
import net.minecraft.world.item.enchantment.Enchantments;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;

Expand All @@ -15,9 +13,9 @@
*/
public class ModEnchantmentTagsProvider extends EnchantmentTagsProvider
{
public ModEnchantmentTagsProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, String modId, @Nullable ExistingFileHelper existingFileHelper)
public ModEnchantmentTagsProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, String modId)
{
super(output, registries, modId, existingFileHelper);
super(output, registries, modId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;

Expand All @@ -19,9 +17,9 @@
*/
public class ModItemTagsProvider extends ItemTagsProvider
{
public ModItemTagsProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider, CompletableFuture<TagLookup<Block>> blockTagsProvider, String modId, @Nullable ExistingFileHelper existingFileHelper)
public ModItemTagsProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider, CompletableFuture<TagLookup<Block>> blockTagsProvider, String modId)
{
super(packOutput, lookupProvider, blockTagsProvider, modId, existingFileHelper);
super(packOutput, lookupProvider, blockTagsProvider, modId);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion NeoForge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Visit the GitHub Wiki for more information on everything this mod adds.
# 'required' requires the mod to exist, 'optional' does not
# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning
type="required"
versionRange="[21.4.41-beta,)"
versionRange="[21.4.47-beta,)"
ordering="NONE"
side="BOTH"
[[dependencies.advancednetherite]]
Expand Down

0 comments on commit b557721

Please sign in to comment.