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

Switched to vanilla values to stop movement from flagging anticheats #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

loldoob
Copy link

@loldoob loldoob commented Nov 28, 2023

The values in the current version flag some anticheats. I switched them to the values from MoveEntityWithHeading in EntityLivingBase.java. These values now emulate vanilla movement with 99.9999999793% accuracy.

Copy link
Member

@extremeheat extremeheat left a comment

Choose a reason for hiding this comment

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

Listing

@@ -533,7 +535,7 @@ function Physics (mcData, world) {
// Calculate what the speed is (0.1 if no modification)
const attributeSpeed = attribute.getAttributeValue(playerSpeedAttribute)
inertia = (blockSlipperiness[blockUnder.type] || physics.defaultSlipperiness) * 0.91
acceleration = attributeSpeed * (0.1627714 / (inertia * inertia * inertia))
acceleration = attributeSpeed * (0.16277136 / (inertia * inertia * inertia))
Copy link
Member

Choose a reason for hiding this comment

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

This is the only actual change in this PR. The other changes have no effect, you can revert them. If there are errors in calculation, they are likely to be caused by 64-bit vs 32-bit float differences, and that's what Math.fround is supposed to fix.

@frej4189
Copy link

Very likely that these values differ between versions.

@rom1504
Copy link
Member

rom1504 commented Nov 29, 2023 via email

@loldoob
Copy link
Author

loldoob commented Nov 30, 2023

I measured the difference in speed values across many different situations and it was off by 0.0000000207. The difference somes from 32 bit to 64 bit conversions from floats to doubles.

@@ -690,7 +692,7 @@ function Physics (mcData, world) {
vel.y += 0.04
} else if (entity.onGround && entity.jumpTicks === 0) {
const blockBelow = world.getBlock(entity.pos.floored().offset(0, -0.5, 0))
vel.y = Math.fround(0.42) * ((blockBelow && blockBelow.type === honeyblockId) ? physics.honeyblockJumpSpeed : 1)
vel.y = 0.42 * ((blockBelow && blockBelow.type === honeyblockId) ? physics.honeyblockJumpSpeed : 1)

Choose a reason for hiding this comment

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

@rom1504 rom1504 added this to Needs triage in PR Triage Dec 17, 2023
@rom1504 rom1504 moved this from Needs triage to Waiting for user input in PR Triage Dec 17, 2023
@rom1504
Copy link
Member

rom1504 commented Dec 31, 2023

please fix

@rom1504 rom1504 moved this from Waiting for user input to Almost too old in PR Triage Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
PR Triage
  
Almost too old
Development

Successfully merging this pull request may close these issues.

None yet

4 participants