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

Fixes a door-related client-prediction bug #1615

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sero583
Copy link
Contributor

@sero583 sero583 commented Sep 16, 2020

When cancelling the DoorToggleEvent or PlayerInteractEvent, if the player pressed the upper part of the door block it will remain open. Sending an block update to the block below seems to fix this issue.

Q: Is this considered as a hack?
@@ -293,6 +293,7 @@ public boolean toggle(Player player) {
this.getLevel().getServer().getPluginManager().callEvent(event);

if (event.isCancelled()) {
getLevel().sendBlocks(new Player[] {player}, new Block[] {this.down()}); // fixes a client-prediction bug
Copy link
Member

@SupremeMortal SupremeMortal Sep 18, 2020

Choose a reason for hiding this comment

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

If this only affects the upper part of the door, the code should check for that otherwise it's going to update the block below the door when the lower part is pressed.

Copy link
Contributor Author

@sero583 sero583 Sep 21, 2020

Choose a reason for hiding this comment

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

@SupremeMortal I know, anyway this fixes it. Updating only the upper half is leading to nothing. Updating both halfs is just unneeded work, as it seems. So just update the lower half.

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