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

Inability to get all classes targetted by mixin #661

Open
0xJoeMama opened this issue Mar 28, 2024 · 6 comments
Open

Inability to get all classes targetted by mixin #661

0xJoeMama opened this issue Mar 28, 2024 · 6 comments

Comments

@0xJoeMama
Copy link

0xJoeMama commented Mar 28, 2024

While developing a mod loader as a side project for fun, I run into the following issue:
Mixins requires a class node, which means that all classes passed through to it, need to be parsed at runtime.
After some performance testing, I found out that that increases classloading times by a large enough amount to have me concerned(an average of 0.5s on my machine, when starting up minecraft through the loader).
So I thought: "That's no big deal. I'll just ask mixin what classes it targets, so I may only parse them if required".
However, after looking around, I can't seem to find any public API in mixin, that allows getting the classes targetted by mixin, or whether a specific class is a mixin target. Looking at the MixinConfig class, the required methods do exist, however they are package private.

And so I'd like to know: is there any way to do that? If not could a feature like this be implemented?

@LlamaLad7
Copy link
Contributor

No, Mixin only parses the classnode if it needs to modify it. You never need to parse the node yourself. Look at fabric's implementation.

@0xJoeMama
Copy link
Author

That doesn't seem to be the case.
Look here:

protected final ClassNode readClass(String className, byte[] basicClass, boolean cacheReader) {

@LlamaLad7
Copy link
Contributor

@0xJoeMama
Copy link
Author

Yes but I do use IMixinTransformer. However the exposed methods, either take in a ClassNode or take in a byte array, which is then parsed into a ClassNode. Checking the transformClassBytes method in MixinTransformer, leads to a call to transformClass which in turn calls readClass which parses the ClassNode. Unless I am missing something.

public byte[] transformClassBytes(String name, String transformedName, byte[] basicClass) {

public byte[] transformClass(MixinEnvironment environment, String name, byte[] classBytes) {

@0xJoeMama
Copy link
Author

There has been no response on this for a week. Anything new?

@Geolykt
Copy link

Geolykt commented Apr 4, 2024

I'd not be worried - it is quite usual for issues to go silent in an issue tracker. And you shouldn't really expect a rather fast development cycle for Mixin so it might take a long time till it gets resolved.

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

No branches or pull requests

3 participants