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

Block break progress improvement #6500

Open
wants to merge 15 commits into
base: stable
Choose a base branch
from

Conversation

GameParrot
Copy link
Contributor

Fixes block break progress being inaccurate when not on ground or swimming. Also fixes syncing block break speed with client.

Related issues & PRs

Changes

API changes

Added Player::isActuallyOnGround(), more accurate than Player::isOnGround() but slower.

Behavioural changes

Block breaking progress is now much closer to vanilla.

In-Game Testing

Before:
https://github.com/user-attachments/assets/22f50b6e-f994-4a17-8dfc-53df70a8d6eb
After:
https://github.com/user-attachments/assets/3341eaaf-2bbc-4ac1-ad35-39947e907080

@GameParrot GameParrot requested a review from a team as a code owner November 13, 2024 15:45
@dktapps
Copy link
Member

dktapps commented Nov 13, 2024

Duplicates #5581

@dktapps
Copy link
Member

dktapps commented Nov 14, 2024

@GameParrot what's your source of information for the data in this PR?

@dktapps dktapps added Category: Gameplay Related to Minecraft gameplay experience Type: Enhancement Contributes features or other improvements to PocketMine-MP Status: Insufficiently Tested labels Nov 14, 2024
@GameParrot
Copy link
Contributor Author

@GameParrot what's your source of information for the data in this PR?

Haste speed modifier was from the wiki, mining fatigue speed modifier was found by testing (wiki numbers inaccurate)

@dktapps
Copy link
Member

dktapps commented Nov 15, 2024

I'd test those thoroughly if I were you. The last guy that tried to do this in #5581 couldn't get them to fully match up, not with wiki sources and not by guesswork either.

Even better if you can pull up an old BDS in IDA and find the code that handles this in vanilla.

@GameParrot
Copy link
Contributor Author

I'd test those thoroughly if I were you. The last guy that tried to do this in #5581 couldn't get them to fully match up, not with wiki sources and not by guesswork either.

Even better if you can pull up an old BDS in IDA and find the code that handles this in vanilla.

Haste and mining fatigue seem pretty much perfect from my testing (tested with both low and high levels)

src/player/SurvivalBlockBreakHandler.php Outdated Show resolved Hide resolved
src/player/SurvivalBlockBreakHandler.php Outdated Show resolved Hide resolved
/**
* Checks if the player is currently on the ground. This is more accurate than {@link Player::isOnGround()} but slower.
*/
public function isActuallyOnGround() : bool{
Copy link
Member

Choose a reason for hiding this comment

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

Something like calculate or smth in the name can be better than this function combined with docs ?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'm not a fan of this naming either. Also, why do we actually need this?

Copy link
Contributor Author

@GameParrot GameParrot Nov 21, 2024

Choose a reason for hiding this comment

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

Yeah, I'm not a fan of this naming either. Also, why do we actually need this?

We need it because when using the normal is on ground method the break progress indicator is still too fast when jumping. What should it be renamed to?

src/player/Player.php Outdated Show resolved Hide resolved
src/player/SurvivalBlockBreakHandler.php Show resolved Hide resolved
src/player/SurvivalBlockBreakHandler.php Show resolved Hide resolved
src/player/SurvivalBlockBreakHandler.php Show resolved Hide resolved
@@ -869,7 +869,7 @@ static function() : void{
* Checks if the player is currently on the ground. This is more accurate than {@link Player::isOnGround()} but slower.
*/
public function isActuallyOnGround() : bool{
$bb = $this->boundingBox->expandedCopy(0, 0.001, 0);
$bb = $this->boundingBox->expandedCopy(-0.001, 0.001, -0.001);
Copy link
Member

Choose a reason for hiding this comment

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

This change doesn't look related to the PR. Why would this be needed for ground calculation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes inaccurate progress at high x/z coordinates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Gameplay Related to Minecraft gameplay experience Status: Insufficiently Tested Status: Waiting on Author Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants