-
Notifications
You must be signed in to change notification settings - Fork 296
Move builtin transform selection to game provider #1056
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,12 +20,15 @@ | |
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
|
||
import net.fabricmc.api.Environment; | ||
import net.fabricmc.loader.api.metadata.ModMetadata; | ||
import net.fabricmc.loader.impl.game.patch.GameTransformer; | ||
import net.fabricmc.loader.impl.launch.FabricLauncher; | ||
import net.fabricmc.loader.impl.util.Arguments; | ||
import net.fabricmc.loader.impl.util.LoaderUtil; | ||
import net.fabricmc.loader.impl.util.SystemProperties; | ||
|
||
public interface GameProvider { // name directly referenced in net.fabricmc.loader.impl.launch.knot.Knot.findEmbedddedGameProvider() and service loader records | ||
String getGameId(); | ||
|
@@ -38,6 +41,24 @@ public interface GameProvider { // name directly referenced in net.fabricmc.load | |
Path getLaunchDirectory(); | ||
boolean isObfuscated(); | ||
boolean requiresUrlClassLoader(); | ||
Set<BuiltinTransform> getBuiltinTransforms(String className); | ||
|
||
enum BuiltinTransform { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm unfamiliar with these terms. Specifically EDIT: I put this note in the wrong spot. It's for the enum values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I adjusted it, class tweakers is a bit of a future term for this branch, it's the new and eventually more powerful replacement for access wideners. |
||
/** | ||
* Removes classes, fields and methods annotated with a different {@literal @}{@link Environment} from the current runtime. | ||
*/ | ||
STRIP_ENVIRONMENT, | ||
/** | ||
* Widens all package-internal access modifiers to public (protected and package-private, but not private). | ||
* | ||
* <p>This only has an effect if the mappings or {@link SystemProperties#FIX_PACKAGE_ACCESS} require these access modifications. | ||
*/ | ||
WIDEN_ALL_PACKAGE_ACCESS, | ||
/** | ||
* Applies class tweakers, including access wideners, as supplied by mods. | ||
*/ | ||
CLASS_TWEAKS, | ||
} | ||
|
||
boolean isEnabled(); | ||
boolean locateGame(FabricLauncher launcher, String[] args); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this a default method for backwards compat? Other games couldn't use transforms previously so an empty set would make sense.
Doesn't really matter too much though.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't usually do this for internal interfaces like this, a custom GameProvider is probably better off with thinking about what the game actually wants.
We don't know what the right package for an arbitrary game would be and I haven't implemented tracking what a class is yet (game, game lib, mod, maybe more types).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 makes sense.