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

fix hitbox issues on newer versions of minecraft #116

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

Conversation

SilkePilon
Copy link

In newer versions of minecraft there are some minor changes to the hitbox system

this wont affect older versions.

examples of the bug:
imagdwae
image

@rom1504 rom1504 added this to Needs triage in PR Triage Jul 13, 2024
@rom1504
Copy link
Member

rom1504 commented Jul 13, 2024

thoughts @IceTank ?

@IceTank
Copy link
Contributor

IceTank commented Jul 13, 2024

@SilkePilon Did you base these changes on any differences you found between the current prismarine-physics code and the Java code? This might trigger anti cheat plugins if horizontal collisions don't line up anymore between Java and prismarine-physics.
Nevertheless, this is probably a good solution for the time being that should work for most cases until someone comes up with a better idea.

@@ -115,7 +115,7 @@ function Physics (mcData, world) {
if (block) {
const blockPos = block.position
for (const shape of block.shapes) {
const blockBB = new AABB(shape[0], shape[1], shape[2], shape[3], shape[4], shape[5])
const blockBB = new AABB(shape[0] - 0.01, shape[1], shape[2] - 0.01, shape[3] + 0.01, shape[4], shape[5] + 0.01)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment explaining why the bounding box is increased here?
Also, this check now applies for all versions. It might be better to do this version specific. As far as I know, it was working fine in older versions of the game.

Copy link
Contributor

Choose a reason for hiding this comment

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

@SilkePilon
Copy link
Author

I made this change at a recommendation of vakore on Discord. Apparently the current system isn't perfect at handling hitbox's. As sometimes the hitbox ends up inside a block and makes the bot unable to move by extending the hitbox a bit this fixes the issue sometimes. Tho it's not a perfect solution and more of a "hack".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
PR Triage
  
Needs triage
Development

Successfully merging this pull request may close these issues.

None yet

3 participants