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

updating activateItem #3445

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

Conversation

GenerelSchwerz
Copy link
Contributor

bot.activateItem and bot.deactivateItem both fail on new version of anticheat due to not specifying the sequence.

For using a bow:
image

For eating (duplicate use_item due to immediately attempting to eat the next food)
image

For using a shield:
image

I do not believe there are any breaking changes.

@@ -122,17 +124,26 @@ function inject (bot, { hideErrors }) {
})
} else if (bot.supportFeature('useItemWithOwnPacket')) {
bot._client.write('use_item', {
hand: offHand ? 1 : 0
hand: offHand ? 1 : 0,
sequence: ++sequence
Copy link
Member

Choose a reason for hiding this comment

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

Does this always increment? Can you put this increment operation up top as opposed to inside the packet body?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, to my knowledge it always increments. Decided to spam until it passed 8bit mark; I'm not going to continue doing so further.

I'll update the code, but personally I feel moving it upwards is unnecessary.

image

@GenerelSchwerz
Copy link
Contributor Author

image

The checks are failing for reasons completely unrelated to my changes. Just a head's up. My changes are not breaking, I have run the tests on my local machine. It is timeouts causing issues.

@extremeheat
Copy link
Member

What I mean by moving it upward is moving it out of the feature check and keeping it as a proper internal counter.

@GenerelSchwerz
Copy link
Contributor Author

image

Could the 1.18.2 CI be rerun? This error has nothing to do with me.

@GenerelSchwerz
Copy link
Contributor Author

What I mean by moving it upward is moving it out of the feature check and keeping it as a proper internal counter.

Oh! I'm not sure earlier versions have, hence why I put in a feature check.

I can just move the sequence increment itself.


if (bot.supportFeature('useItemWithOwnPacket')) {
body.face = 0
body.sequence = 0
Copy link
Member

Choose a reason for hiding this comment

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

Note, you can supply extra fields on packets without any problems. If the field is not used on a particular version it will be ignored. I'm curious why the sequence is always 0 here, is it being reset or just fixed to 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is just fixed to zero. I have no idea to be honest. It doesn't change the sequence count.

I decided to add a feature support there since I wasn't sure if the face affected anything and just wanted to be as legitimate as possible without disrupting the original face (5)'s implementation.

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

Successfully merging this pull request may close these issues.

2 participants