-
Notifications
You must be signed in to change notification settings - Fork 417
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
Add AFTER_CLIENT_WORLD_CHANGE #4173
Add AFTER_CLIENT_WORLD_CHANGE #4173
Conversation
...-v1/src/client/java/net/fabricmc/fabric/api/entity/event/client/ClientWorldChangeEvents.java
Outdated
Show resolved
Hide resolved
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.
Make sure to add a section to the module README
that describes the ClientWorldEvents
class.
/** | ||
* An event which is called after the client world has been changed. | ||
*/ | ||
public static final Event<AfterClientWorldChange> AFTER_CLIENT_WORLD_CHANGE = EventFactory.createArrayBacked(AfterClientWorldChange.class, callbacks -> (client, world) -> { |
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 wonder if this event should be named 'load' to match the corresponding event in the ServerWorldEvents
class. The parameters are even similar, being a server or client and the respectively-sided world. The main difference is that the world here can be null
, which is represented by an unload event in the ServerWorldEvents
class instead.
...-v1/src/client/java/net/fabricmc/fabric/api/client/event/lifecycle/v1/ClientWorldEvents.java
Outdated
Show resolved
Hide resolved
/** | ||
* An event which is called after the client world has been changed. | ||
*/ | ||
public static final Event<AfterClientWorldChange> AFTER_CLIENT_WORLD_CHANGE = EventFactory.createArrayBacked(AfterClientWorldChange.class, callbacks -> (client, world) -> { |
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 believe this event should be called LOAD
due to these two reasons:
- To be consistent with the
ServerWorldEvents
class. - This event is also called on the initial world load, and it doesn't make sense to be called
AFTER_CLIENT_WORLD_CHANGE
.
Also, I assume this event only fires once on world change, not once null
then once with the new world?
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.
That makes sense, I have completed the modifications.
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 dont think load is correct at all, when joining a server, or switching a world you arent loading (from the disk) the world at all.
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 have reverted its name now.
private ClientWorldEvents() { | ||
} |
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 think this is going to pass the checkstyle? The constructor should be between the field and the interface.
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'm sorry, but I wrote it by imitating other classes within the same package. If there are any issues, could you provide more information?
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.
Try running the check
task (./gradlew check
). Typically GitHub Actions would provide context as well, but a maintainer would need to approve the run first.
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.
Thank you for your guidance. I received a BUILD SUCCESSFUL
after running the check task.
Now that I think about this, what's the difference between this event and |
Switching dimensions changes the |
9ab01ea
to
4070a1d
Compare
* add AFTER_CLIENT_WORLD_CHANGE * fix * move * add description to README and change class to final with a private constructor * revert the event name
* add AFTER_CLIENT_WORLD_CHANGE * fix * move * add description to README and change class to final with a private constructor * revert the event name
Add an event for the current ClientWorld being updated.
Fixes #3714