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

refactor: introduce a DummyInput wrapper #253

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

Conversation

MattSturgeon
Copy link
Member

DummyInput can be used to provide an empty Input instance that remembers some state from a previous Input instance.

This small refactor adds a DummyInput class that extends Input and takes over the responsibility for persisting the player's "is sneaking" state when the player is not actively being controlled.

  • This shifts some responsibility away from the main Freecam class.
  • This will make persisting additional state (jump, sprint?) easier.
  • This will make porting to 1.21.3 easier, as the Input class has been refactored upstream.

Currently only sneak is persisted. In the future we may decide to persist additional state, such as sprint or jump.

`DummyInput` can be used to provide an empty `Input` instance that remembers some state from a previous `Input` instance.

In the future we may decide to persist additional state, such as sprint or jump.

Currently only sneak is persisted.
Resetting `freeCamera`'s input is pointless immediately before setting `freeCamera = null`.
@MattSturgeon MattSturgeon mentioned this pull request Nov 2, 2024
@MattSturgeon
Copy link
Member Author

This is currently written for 1.21, I'll rebase it on main to target 1.21.3 and stash these changes in a temp branch as we'll need them for backporting to 1.21 and lower

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

Successfully merging this pull request may close these issues.

1 participant