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

Using Mixin without Minecraft #46

Closed
ReneHollander opened this issue May 19, 2015 · 6 comments
Closed

Using Mixin without Minecraft #46

ReneHollander opened this issue May 19, 2015 · 6 comments

Comments

@ReneHollander
Copy link

Hello!

Is there a way to use Mixin without Minecraft, Forge, Sponge, etc? I want to use it in some other projects and initially thought it would be able to be used in a standalone project as the repostitory description suggested: "Mixin is a trait/mixin framework for Java using ASM". I then read further and found out it won
't work for my application in for example a Bukkit Plugin (I am still using it because I am too lazy to move to the SpongeAPI...)

  • Rene
@Mumfrey
Copy link
Member

Mumfrey commented May 19, 2015

You can use Mixin in any application where you control the class loading, for example your own projects or by "wrapping" an existing application. This is possible because Mixin uses LaunchWrapper and other than the "default" support for Minecraft, LaunchWrapper is basically an environment-agnostic extensible ClassLoader system.

So yes, other than LaunchWrapper, you can use Mixin without any of the other components like FML or whatever.

For obvious reasons you cannot use Mixin with Java EE applications, and obviously using it in a Bukkit plugin is completely impossible. But for standard applications all you need to do is write a Tweaker to plug in to LaunchWrapper and bootstrap your application using Launch.

@Mumfrey Mumfrey closed this as completed May 19, 2015
@phase
Copy link

phase commented Jun 1, 2015

How would one initialize Mixins in a standalone project? Would you need to use LegacyWrapper if you weren't using Minecraft?

@Mumfrey
Copy link
Member

Mumfrey commented Jun 1, 2015

Yep, but as I said, LaunchWrapper is entirely application-agnostic and is open source as well, so it's pretty straightforward to use.

@phase
Copy link

phase commented Jun 2, 2015

Would I need to make a new Tweaker & TweakerInjector for my application?

@liach
Copy link

liach commented Jun 2, 2015

https://github.com/thog/universalat

which works on bukkit.

@Mumfrey
Copy link
Member

Mumfrey commented Jun 2, 2015

Would I need to make a new Tweaker & TweakerInjector for my application?

Just a tweaker is sufficient, the contract of tweakers is pretty straightforward and you can read any of the many examples which are floating around.

https://github.com/thog/universalat

which works on bukkit.

Yes but not as a plugin, so that's a stupid example. As I said above, "You can use Mixin in any application where you control the class loading" and this is true of most applications, if you wrap the application then you can do mostly whatever you want. I mean, that's the entire point of LaunchWrapper in the first place!

There are ways around this limitation but they're hacky and far from straightforward.

i509VCB pushed a commit to QuiltMC/Mixin that referenced this issue Apr 21, 2021
Build using GHA
Drop Java 6 and 7 support
Bump to ASM 9
Update gradle
New versioning
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

4 participants