-
Notifications
You must be signed in to change notification settings - Fork 6
[Lifecycle Events] add Minecraft instance API #46
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
Conversation
|
does this include the server? |
It doesn't. I do want to add it but I am not sure yet exactly how it should look. For example, should such an API just return a |
|
What about an injected interface with a default static method on MinecraftServer? that way one can "emulate" |
|
Do those work transitively? |
|
I think so, but would need to check |
|
Hmm I wonder how that'll work between versions that already that method vs versions that don't. Like if we add that method to 1.2 and below, it will not be mapped to intermediary (since it's not a MC method), but in 1.3+ it will. So if you compile a mod against 1.2 it will not work in 1.3. Unless we also inject the interface in 1.3 and above and just give the method a different name (like |
|
I suggest to start with the assumption that major versions aren't compatible, so the mod would need to be recompiled anyway |
|
still, preferably I would avoid imposing that through OSL where feasible |
|
hold on - the injected interface would be useless for this since the instance getter is static |
[Lifecycle Events] add Minecraft instance API
Adds a simple wrapper class for retrieving the current
Minecraftinstance. This is useful given thatMinecraft::getInstancewas only added in one of the 1.3 snapshots.The class looks as follows:
Internally this returns the instance if it is available, and otherwise throws an
IllegalStateException. The instance is available from the start of theinitmethod until the end of theshutdownmethod.