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

[1.21.4] Tear out ExistingFileHelper #1799

Merged
merged 9 commits into from
Dec 28, 2024

Conversation

ApexModder
Copy link
Contributor

Follow up PR from #1725 which aims to deprecate ExistingFileHelper (EFH) further with no planned replacement.

This is done by marking EFH as @Nullable in as many places as possible and providing overloaded constructors to allow constructing providers without needing to pass a EFH instance.

All NeoForge and test providers have been updated to use the new overloaded constructors, this is to validate that everything still works when no EFH instance is provided.

Remove usages of `ExistingFileHelper` is as many neoforge/test data providers as possible
@ApexModder ApexModder added cleanup Change that isn't an enhancement or a bug fix 1.21.4 Targeted at Minecraft 1.21.4 labels Dec 24, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Dec 24, 2024

  • Publish PR to GitHub Packages

Last commit published: 3ee5bc79a62d18f0cb60ed631cf47b541bd1d847.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #1799' // https://github.com/neoforged/NeoForge/pull/1799
        url 'https://prmaven.neoforged.net/NeoForge/pr1799'
        content {
            includeModule('net.neoforged', 'neoforge')
            includeModule('net.neoforged', 'testframework')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr1799.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1799
cd NeoForge-pr1799
curl -L https://prmaven.neoforged.net/NeoForge/pr1799/net/neoforged/neoforge/21.4.53-beta-pr-1799-pr-kill-existing-file-helper/mdk-pr1799.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

@ApexModder ApexModder changed the title [1.21.4] Deprecate ExistingFileHelper and mark nullable everywhere [1.21.4] Tear out ExistingFileHelper Dec 24, 2024
@ApexModder
Copy link
Contributor Author

PR has been updated to fully tear out ExistingFileHelper rather then deprecating it for removal

@neoforged-compatibility-checks
Copy link

neoforged-compatibility-checks bot commented Dec 24, 2024

@ApexModder, this PR introduces breaking changes.
Fortunately, this project is currently accepting breaking changes, but if they are not intentional, please revert them.
Last checked commit: 3ee5bc79a62d18f0cb60ed631cf47b541bd1d847.

Compatibility checks

neoforge (:neoforge)

  • net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/minecraft/data/tags/PaintingVariantTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeSpriteSourceProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/minecraft/data/tags/StructureTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/ExistingFileHelper
    • ❗ API class no longer exists
  • net/neoforged/neoforge/data/event/GatherDataEvent$DataProviderFromOutputFileHelper
    • ❗ API class no longer exists
  • net/minecraft/data/tags/ItemTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/JsonCodecProvider
    • <init>(Lnet/minecraft/data/PackOutput;Lnet/minecraft/data/PackOutput$Target;Ljava/lang/String;Lnet/minecraft/server/packs/PackType;Lcom/mojang/serialization/Codec;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
    • resourceType:Lnet/neoforged/neoforge/common/data/ExistingFileHelper$ResourceType;: ❗ API field was removed
    • existingFileHelper:Lnet/neoforged/neoforge/common/data/ExistingFileHelper;: ❗ API field was removed
  • net/neoforged/neoforge/common/data/SoundDefinitionsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/minecraft/data/tags/EntityTypeTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/data/event/GatherDataEvent$Server
    • <init>(Lnet/neoforged/fml/ModContainer;Lnet/minecraft/data/DataGenerator;Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataGeneratorConfig;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/data/loading/DatagenModLoader
    • begin(Ljava/util/Set;Ljava/nio/file/Path;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Set;ZZZZLjava/lang/String;Ljava/io/File;Ljava/lang/Runnable;Lnet/neoforged/neoforge/data/event/GatherDataEvent$GatherDataEventGenerator;Lnet/minecraft/data/DataGenerator;)V: ⚠ API method was removed
  • net/minecraft/data/tags/PoiTypeTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/minecraft/data/tags/GameEventTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/minecraft/data/tags/CatVariantTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/data/event/GatherDataEvent$DataProviderFromOutputLookupFileHelper
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/neoforged/neoforge/common/data/BlockTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider
    • ⚠ Class missing superclass of net/neoforged/neoforge/common/data/AdvancementProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/neoforged/neoforge/common/data/AdvancementProvider
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/data/AdvancementProvider$AdvancementGenerator
    • ❗ API class no longer exists
  • net/minecraft/data/tags/InstrumentTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider$NeoForgeAdvancementGenerator
    • ⚠ Class missing interface: net/neoforged/neoforge/common/data/AdvancementProvider$AdvancementGenerator
    • generate(Lnet/minecraft/core/HolderLookup$Provider;Ljava/util/function/Consumer;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/minecraft/data/tags/TagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
    • <init>(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
    • existingFileHelper:Lnet/neoforged/neoforge/common/data/ExistingFileHelper;: ❗ API field was removed
  • net/neoforged/neoforge/common/data/internal/VanillaSoundDefinitionsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/ExistingFileHelper$ResourceType
    • ❗ API class no longer exists
  • net/neoforged/neoforge/data/event/GatherDataEvent
    • createBlockAndItemTags(Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataProviderFromOutputLookupFileHelper;Lnet/neoforged/neoforge/data/event/GatherDataEvent$ItemTagsProvider;)V: ❗ API method was removed
    • <init>(Lnet/neoforged/fml/ModContainer;Lnet/minecraft/data/DataGenerator;Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataGeneratorConfig;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
    • createProvider(Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataProviderFromOutputLookupFileHelper;)Lnet/minecraft/data/DataProvider;: ❗ API method was removed
    • createProvider(Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataProviderFromOutputFileHelper;)Lnet/minecraft/data/DataProvider;: ❗ API method was removed
    • getExistingFileHelper()Lnet/neoforged/neoforge/common/data/ExistingFileHelper;: ❗ API method was removed
  • net/neoforged/neoforge/common/data/ExistingFileHelper$IResourceType
    • ❗ API class no longer exists
  • net/minecraft/data/tags/WorldPresetTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/neoforged/neoforge/common/data/ParticleDescriptionProvider
    • <init>(Lnet/minecraft/data/PackOutput;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
    • fileHelper:Lnet/neoforged/neoforge/common/data/ExistingFileHelper;: ❗ API field was removed
  • net/minecraft/data/tags/FluidTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/extensions/IAdvancementBuilderExtension
    • save(Ljava/util/function/Consumer;Lnet/minecraft/resources/ResourceLocation;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)Lnet/minecraft/advancements/AdvancementHolder;: ❗ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeDamageTypeTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeFluidTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/minecraft/data/tags/BannerPatternTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/data/event/GatherDataEvent$GatherDataEventGenerator
    • create(Lnet/neoforged/fml/ModContainer;Lnet/minecraft/data/DataGenerator;Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataGeneratorConfig;)Lnet/neoforged/neoforge/data/event/GatherDataEvent;: ❗ Method was made abstract
    • create(Lnet/neoforged/fml/ModContainer;Lnet/minecraft/data/DataGenerator;Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataGeneratorConfig;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)Lnet/neoforged/neoforge/data/event/GatherDataEvent;: ❗ API method was removed
  • net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/minecraft/data/tags/EnchantmentTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/minecraft/data/tags/BiomeTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/data/event/GatherDataEvent$DataGeneratorConfig
    • <init>(Ljava/util/Set;Ljava/nio/file/Path;Ljava/util/Collection;Ljava/util/concurrent/CompletableFuture;ZZZZLnet/minecraft/data/DataGenerator;)V: ❗ API method was removed
  • net/neoforged/neoforge/data/event/GatherDataEvent$ItemTagsProvider
    • create(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)Lnet/minecraft/data/tags/TagsProvider;: ❗ API method was removed
    • create(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/data/tags/TagsProvider;: ❗ Method was made abstract
  • net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ⚠ API method was removed
  • net/neoforged/neoforge/data/event/GatherDataEvent$Client
    • <init>(Lnet/neoforged/fml/ModContainer;Lnet/minecraft/data/DataGenerator;Lnet/neoforged/neoforge/data/event/GatherDataEvent$DataGeneratorConfig;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/minecraft/data/tags/IntrinsicHolderTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/util/function/Function;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
    • <init>(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/util/function/Function;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/data/SpriteSourceProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed
  • net/minecraft/data/tags/DamageTypeTagsProvider
    • <init>(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/neoforged/neoforge/common/data/ExistingFileHelper;)V: ❗ API method was removed

marchermans
marchermans previously approved these changes Dec 24, 2024
@KnightMiner
Copy link
Contributor

I'm just going to go on record saying I extensively use the existing file helper to run datagen based on existing files. Be it taking in 1 or more existing images and generating a new image based on them, or taking in existing structure NBT and modifying it for output, or even in some cases taking a JSON file and manipulating it for a generated file.

Removing this API would break every single one of those, you need to provide a replacement unless you are just planning to piss off modders again by removing APIs we are actively using. I am not the only one making use of existing files for datagen, it's useful for far more than checking if a file is present.

We don't need anything fancy, just needs to be able to fetch a resource from either our own resources, vanilla resources, or a mod dependency resources

Copy link
Contributor

@Minecraftschurli Minecraftschurli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query the community for if this is still being used and requires a replacement
(like @KnightMiner is saying he makes extensive use of it)

Add back `assetIndex`/`assetsDir` to `clientData` run config args
Add back `DataGeneratorTest` sound/particle tests making use of new resource manager
@ApexModder

This comment was marked as outdated.

@Technici4n
Copy link
Member

Here is an example of accessing resources for usage in datagen: https://github.com/AztechMC/Modern-Industrialization/blob/5d9c1b69f3d6d683554f2003f6c688b89909e676/src/client/java/aztech/modern_industrialization/datagen/texture/TexturesProvider.java#L73. I think it's really simple, and doesn't require any specific NeoForge extension. @KnightMiner

@ApexModder ApexModder dismissed Minecraftschurli’s stale review December 28, 2024 08:07

Dismissed due to ResourceManager providing what community used ExistingFileHelper for

Copy link
Contributor

@Minecraftschurli Minecraftschurli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ApexModder ApexModder merged commit 821e47f into neoforged:1.21.x Dec 28, 2024
6 checks passed
@ApexModder ApexModder deleted the pr/kill-existing-file-helper branch December 28, 2024 19:47
@neoforged-releases
Copy link

🚀 This PR has been released as NeoForge version 21.4.47-beta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.4 Targeted at Minecraft 1.21.4 breaking change Breaks binary compatibility cleanup Change that isn't an enhancement or a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants