-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
ref(event): change tick event to have pre/post classes #9890
ref(event): change tick event to have pre/post classes #9890
Conversation
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.
Looks good to me - makes it harder for devs to accidentally have their things run twice per tick and improves consistency with other events.
Approving but leaving Lex to decide if he wants to merge now or next MC version.
Throw some bin compat bouncers with |
For the deprecated tag do you mean that I should restore the variable and deprecate it? |
Yes doing so would allow it to be pulled in 1.20.4, however with 1.20.5 coming here soon it doesn't matter. |
Alright I've rebased it for latest versions & added back the phases with a deprecated annotation too |
@@ -38,78 +38,147 @@ public static class ServerTickEvent extends TickEvent { | |||
private final BooleanSupplier haveTime; | |||
private final MinecraftServer server; | |||
|
|||
public ServerTickEvent(Phase phase, BooleanSupplier haveTime, MinecraftServer server) | |||
{ | |||
protected ServerTickEvent(BooleanSupplier haveTime, MinecraftServer server, Phase phase) { |
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.
All of these public -> protected are binary breaks.
Its fine to change them to protected {and move the phase to the end} but the public ones have to stay as bouncers.
And also you should mark the proper time for removal
@Deprecated(forRemoval = true, since = "1.20.6")
Maintaining binary compatibility means that your PR can be backported without major modifications
protected ServerTickEvent(BooleanSupplier haveTime, MinecraftServer server, Phase phase) { | |
@Deprecated(forRemoval = true, since = "1.20.6") | |
public ServerTickEvent(Phase phase, BooleanSupplier haveTime, MinecraftServer server) { | |
this(haveTime, server, phase); | |
} | |
protected ServerTickEvent(BooleanSupplier haveTime, MinecraftServer server, Phase phase) { |
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.
Ah yes I completely missed that, thank you! I think I managed to get all of them now
Co-authored-by: LexManos <LexManos@gmail.com>
e43cf89
to
5a9a327
Compare
…e#9890 to 1.20.4) Co-Authored-By: Daniel Norris <33832062+danorris709@users.noreply.github.com>
….4) (#10090) Co-authored-by: Daniel Norris <33832062+danorris709@users.noreply.github.com>
Removes the phase variable in the TickEvent class and changes all the sub classes to have Pre/Post classes, as mentioned in here
Theoretically this would give a minor performance boost due to the singleton nature of the
ClientTickEvent
, however as that was not the primary goal of this I've not included any numbers and only mention this as an extra benefit