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

add MODIFY_PLAYER_MOVEMENT_DURING_USINGITEM #4112

Open
wants to merge 4 commits into
base: 1.21.1
Choose a base branch
from

Conversation

fishshi
Copy link

@fishshi fishshi commented Sep 22, 2024

add a hook for modify player's movement during using item.

solve the issue:
#4103 (comment)


public final class ClientPlayerEvents {
/**
* An event that is called when a player is moving during using an item.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Whats an example usecase?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, a mod may wish to adjust or disable the slowdown when a player is using the mod's custom bow.

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;

public final class ClientPlayerEvents {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Does this also need to be handled on the server somewhere? E.g if I wanted to increase the players speed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to make any changes on the server, as all information related to movement speed is processed on the client and sent to the server. We only need to modify the movement speed on the client. In the test mod, if you want to increase the player's speed, you only need to modify the multiplier coefficient. If you have any thoughts or additional comments, please let me know with more detailed information.

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

Successfully merging this pull request may close these issues.

2 participants