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

New input packet #1702

Open
SergioK29 opened this issue Sep 7, 2024 · 9 comments
Open

New input packet #1702

SergioK29 opened this issue Sep 7, 2024 · 9 comments
Labels
enhancement New feature or request

Comments

@SergioK29
Copy link

SergioK29 commented Sep 7, 2024

Feature description

Latest snapshot 24w36a just added a keyboard input packet.

Client:
@Override
public void tick() {
if (this.getWorld().isPosLoaded(this.getBlockX(), this.getBlockZ())) {
	super.tick();
	this.sendSneakingPacket();
	if (!this.field_54156.equals(this.input.field_54155)) {
		this.networkHandler.sendPacket(new PlayerInputC2SPacket(this.input.field_54155));
		this.field_54156 = this.input.field_54155;
	}
@Override
	public void onPlayerInput(PlayerInputC2SPacket packet) {
		NetworkThreadUtils.forceMainThread(packet, this, this.player.getServerWorld());
		this.player.method_63561(packet.input());
	}
	public record class_10185(boolean forward, boolean backward, boolean left, boolean right, boolean jump, boolean shift, boolean sprint) {

This opens up the possibility for a huge amount of cool new checks.

@SergioK29 SergioK29 added the enhancement New feature or request label Sep 7, 2024
@SamB440
Copy link
Collaborator

SamB440 commented Sep 7, 2024

No it doesn't give us cool new checks, we already have this information from the prediction engine, it's useful to heavily improve performance though. Client also sends an END_TICK packet now too, so idle tick is back.

@SamB440 SamB440 changed the title This is big New input packet Sep 7, 2024
@SergioK29
Copy link
Author

SergioK29 commented Sep 7, 2024

No it doesn't give us cool new checks, we already have this information from the prediction engine, it's useful to heavily improve performance though. Client also sends an END_TICK packet now too, so idle tick is back.

already having the information from the prediction engine is exactly why this is cool, we can compare them for discrepancies, synthetic movement likely wouldn't have the corresponding input in the packet, can also validate sprinting, jumping and sneaking

@SamB440
Copy link
Collaborator

SamB440 commented Sep 7, 2024

That's already what the prediction engine does, validates inputs. All that's changed is we no longer need to bruteforce the possible inputs.

@overkidding
Copy link
Contributor

overkidding commented Sep 9, 2024

No it doesn't give us cool new checks

It could be a good way to check if a client sent a sprinting or smt packet without an input packet or am i wrong

@ManInMyVan
Copy link
Contributor

No it doesn't give us cool new checks

It could be a good way to check if a client sent a sprinting or smt packet without an input packet or am i wrong

Using toggle sprint would flag if we checked for this

@overkidding
Copy link
Contributor

Using toggle sprint would flag if we checked for this

Then if a player is moving but not pressing any key? (Could actually fix auto walk duh now that i think about it)

@ManInMyVan
Copy link
Contributor

Then if a player is moving but not pressing any key?

Yes, we will probably use the client input instead of bruteforcing it

Could actually fix auto walk duh now that i think about it

No, the client can modify this.

@overkidding
Copy link
Contributor

No, the client can modify this.

I know but trash ass clients wouldn't know that the packet exists so it will just start walking without any input

@FirephoenixX02
Copy link

FirephoenixX02 commented Oct 2, 2024

No, the client can modify this.

I know but trash ass clients wouldn't know that the packet exists so it will just start walking without any input

Everyone just sets the walking keybind pressed state to true, its one line, and the client handles all the movement correctly like usual. Don't see a reason why this wouldn't behave the same with the new snapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants