Interface MinecraftResolver

    • Field Detail

      • STORAGE_VERSION

        static final int STORAGE_VERSION
        A version indicator for on-disk storage.

        When a change in how Minecraft artifacts exists that cannot be detected by existing input detection, or would make data unreadable by older versions of the resolver, this version will be incremented.

        See Also:
        Constant Field Values
      • METADATA_VERSION

        static final int METADATA_VERSION
        A version for stored metadata.

        Whenever the STORAGE_VERSION is incremented, this version will be reset to 1

        See Also:
        Constant Field Values
    • Method Detail

      • versions

        VersionManifestRepository versions()
        Get the version manifest repository managed by this resolver.
        Returns:
        the resolver
      • produceAssociatedArtifact

        java.util.concurrent.CompletableFuture<org.spongepowered.gradle.vanilla.resolver.ResolutionResult<java.nio.file.Path>> produceAssociatedArtifact​(MinecraftPlatform side,
                                                                                                                                                         java.lang.String version,
                                                                                                                                                         java.util.Set<ArtifactModifier> modifiers,
                                                                                                                                                         java.lang.String id,
                                                                                                                                                         java.util.Set<AssociatedResolutionFlags> flags,
                                                                                                                                                         java.util.function.BiFunction<MinecraftResolver.MinecraftEnvironment,​java.nio.file.Path,​java.util.concurrent.CompletableFuture<?>> action)
        Given a standard Minecraft artifact, produce a variant of that artifact.

        This variant will synchronize back to the current thread before executing the provider function. This allows for operating in concurrency-sensitive environments, such as a Gradle build.

        To de-duplicate resolution actions, a future may be returned if this action has already been performed, or is in process on another thread. In these cases, the provided provider function will not be executed at all.

        Parameters:
        side - the platform to base off of
        version - the version to base off of
        modifiers - any modifiers to complete the description of the provided argument
        id - An identifier for this artifact
        flags - flags to configure this resolution
        action - the action needed to produce a variant, taking the input environment and a target path
        Returns:
        a future returning the result of resolving a jar path
      • processSyncTasksUntilComplete

        <T> T processSyncTasksUntilComplete​(java.util.concurrent.CompletableFuture<T> future)
                                     throws java.util.concurrent.ExecutionException,
                                            java.lang.InterruptedException
        Block on the completion of a provided future, processing "sync" tasks while that occurs.
        Type Parameters:
        T - the return value type
        Parameters:
        future - the future to await
        Returns:
        the result of the future
        Throws:
        java.util.concurrent.ExecutionException - if the task execution fails
        java.lang.InterruptedException - if the thread executing the future is interrupted