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

Prevent mods from modifying the mod list #235

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

embeddedt
Copy link
Member

This is basically guaranteed to cause unexpected/difficult to debug behavior if someone tries it (accidentally or otherwise).

@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jan 12, 2025

  • Publish PR to GitHub Packages

Last commit published: 0ac9cedc81ff70fc9f0190cab8853212da16752d.

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 #235' // https://github.com/neoforged/FancyModLoader/pull/235
        url 'https://prmaven.neoforged.net/FancyModLoader/pr235'
        content {
            includeModule('net.neoforged.fancymodloader', 'earlydisplay')
            includeModule('net.neoforged.fancymodloader', 'junit-fml')
            includeModule('net.neoforged.fancymodloader', 'loader')
            includeModule('net.neoforged.fancymodloader', 'tests')
        }
    }
}

@neoforged-compatibility-checks

@embeddedt, 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: 0ac9cedc81ff70fc9f0190cab8853212da16752d.

Compatibility checks

loader (:loader)

  • cpw/mods/modlauncher/api/ITransformer
    • ❗ API class no longer exists
  • cpw/mods/util/LambdaExceptionUtils
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformer$Target
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerVotingContext$ClassPredicate
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/serviceapi/ITransformerDiscoveryService
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/ModuleLayerHandler
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/impl/JarContentsImpl
    • ❗ API class no longer exists
  • cpw/mods/util/LambdaExceptionUtils$Consumer_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/TargetType
    • ❗ API class no longer exists
  • cpw/mods/util/LambdaExceptionUtils$Runnable_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerVotingContext$FieldPredicate
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/IModuleLayerManager$Layer
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/ArgumentHandler
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/log/ExtraDataTextRenderer
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/serviceapi/ILaunchPluginService$ITransformerLoader
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/LambdaExceptionUtils$Function_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerActivity
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/serviceapi/ILaunchPluginService$ComputeFlags
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/JarMetadata
    • ❗ API class no longer exists
  • cpw/mods/niofs/union/UnionPathFilter
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/LambdaExceptionUtils$BiConsumer_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/SecureJar$Status
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/DefaultLaunchHandlerService
    • ❗ API class no longer exists
  • cpw/mods/cl/JarModuleFinder
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerVotingContext
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/TypesafeMap$Key
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/IEnvironment
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/serviceapi/ILaunchPluginService
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/SecureJar$ModuleDataProvider
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/TypesafeMap$KeyBuilder
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/VoteDeadlockException
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/LambdaExceptionUtils$Runnable_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/TypesafeMap
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/InvalidLauncherSetupException
    • ❗ API class no longer exists
  • cpw/mods/util/LambdaExceptionUtils$Function_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/niofs/union/UnionPath
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/JarContents
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/BootstrapLaunchConsumer
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/LambdaExceptionUtils$Consumer_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/log/MLClassLoaderContextSelector
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/serviceapi/ILaunchPluginService$Phase
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerActivity$Type
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/VoteRejectedException
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerVotingContext$MethodPredicate
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/EnumerationHelper
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/impl/JarSigningData
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/impl/SecureJarVerifier
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerAuditTrail
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/NamedPath
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/IncompatibleEnvironmentException
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TransformerHolder
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/util/ServiceLoaderUtils
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/LaunchPluginHandler
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformerVotingContext$InsnPredicate
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/impl/Jar
    • ❗ API class no longer exists
  • cpw/mods/cl/ModularURLHandler$IURLProvider
    • ❗ API class no longer exists
  • cpw/mods/cl/ProtectionDomainHelper
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TransformList
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ServiceRunner
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/Launcher
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ILaunchHandlerService
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/ClassTransformer
    • ❗ API class no longer exists
  • cpw/mods/cl/ModularURLHandler
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/IEnvironment$Keys
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/SecureJar
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/LambdaExceptionUtils
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformationService
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/SecureJar$Provider
    • ❗ API class no longer exists
  • cpw/mods/util/Lazy
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/LambdaExceptionUtils$Supplier_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/cl/ModuleClassLoader
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TransformerAuditTrail
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TransformingClassLoader
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/TransformerVoteResult
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/JarContentsBuilder
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/PredicateVisitor
    • ❗ API class no longer exists
  • cpw/mods/niofs/union/UnionFileSystem
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/LazyJarMetadata
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformationService$OptionResult
    • ❗ API class no longer exists
  • cpw/mods/cl/UnionURLStreamHandler
    • ❗ API class no longer exists
  • cpw/mods/util/LambdaExceptionUtils$BiConsumer_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/impl/ModuleJarMetadata
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/log/TransformingThrowablePatternConverter
    • ❗ API class no longer exists
  • cpw/mods/niofs/union/UnionFileSystemProvider
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/IModuleLayerManager
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TestingLaunchHandlerService
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/api/ITransformationService$Resource
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/Environment
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TransformationServiceDecorator
    • ❗ API class no longer exists
  • cpw/mods/util/LambdaExceptionUtils$Supplier_WithExceptions
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/VirtualJar
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TransformTargetLabel
    • ❗ API class no longer exists
  • cpw/mods/jarhandling/impl/SimpleJarMetadata
    • ❗ API class no longer exists
  • cpw/mods/modlauncher/TransformStore
    • ❗ API class no longer exists

this.fileById = this.modFiles.stream().map(IModFileInfo::getMods).flatMap(Collection::stream).map(ModInfo.class::cast).collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile));
this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).toList();
this.sortedList = sortedList.stream().map(IModInfo.class::cast).toList();
this.fileById = Collections.unmodifiableMap(this.modFiles.stream().map(IModFileInfo::getMods).flatMap(Collection::stream).map(ModInfo.class::cast).collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile)));
Copy link
Contributor

Choose a reason for hiding this comment

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

You could also use Collectors#toUnmodifiableMap

@shartte
Copy link
Contributor

shartte commented Jan 12, 2025

@embeddedt Are you intending this to go into any current version?

Otherwise, I'd rather just handle this in startup experiments (and I agree with the change).

@embeddedt
Copy link
Member Author

It would be ideal to get it in 1.21.1 at least (which implies it needs to be in 1.21.4, due to the backporting policy).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants