Skip to content

[VirtualInput] Fix crash when playing back while changing dimensions #248

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

Merged
merged 3 commits into from
May 28, 2025

Conversation

ScribbleTAS
Copy link
Member

@ScribbleTAS ScribbleTAS commented May 27, 2025

In #240 I added a "[VirtualInput] Fix camera being reset to 0 -180 when entering a world", which introduced this crash.

Reason is that the "onDoneLoadingPlayer" event, that I introduced in that PR, is also fired when switching dimensions.
And switching dimensions in this case sets the virtual camera to null, which crashes the playback with a NullPointerException.

And being once again confronted with this "clearing the virtual camera angle at the right moment" problem I realized that this system is pretty idiotic...

To fix this, the virtual camera is now set to null when leaving the game and then initialised when the player is done loading.
This way, the player should retain it's camera angle on world load and the camera angle shouldn't become null unexpectedly.

Changes

  • Rewrote camera resetting and moved it to LoadingScreenHandler
  • Seperated clearing the next camera angle from clear() and renamed the method to clearKeys()
  • Added clearNext() to keyboard, mouse and camera
  • Updated documentation
  • Changed method names in MixinEntityRenderer to start with playback for better consistency

@ScribbleTAS ScribbleTAS self-assigned this May 27, 2025
@ScribbleTAS ScribbleTAS added the Core Issue relates to core concepts label May 27, 2025
@github-project-automation github-project-automation bot moved this to Todo in TASmod May 27, 2025
- Adjusted documentation
- Move VirtualInput#clear from onDoneLoadingPlayer to onPlayerJoinedClientSide
- Renamed VirtualInput#clear to VirtualInput#clearKeys for clarity
- Added clearNext methods to Keyboard and Mouse to be able to clear individual input methods. Also to be consistent with the camera angle
@ScribbleTAS ScribbleTAS changed the title Fix crash when playing back while changing dimensions [VirtualInput] Fix crash when playing back while changing dimensions May 28, 2025
- Fixed documentation in MixinEntityRenderer and renamed mixin methods to better describe the area
@ScribbleTAS ScribbleTAS moved this from Todo to Done in TASmod May 28, 2025
@ScribbleTAS ScribbleTAS moved this from Done to In Progress in TASmod May 28, 2025
@ScribbleTAS ScribbleTAS marked this pull request as ready for review May 28, 2025 09:24
@ScribbleTAS ScribbleTAS requested a review from PancakeTAS May 28, 2025 09:24
@ScribbleTAS ScribbleTAS merged commit 509c761 into MinecraftTAS:develop May 28, 2025
3 checks passed
@ScribbleTAS ScribbleTAS deleted the fix/crash branch May 28, 2025 11:04
@github-project-automation github-project-automation bot moved this from In Progress to Done in TASmod May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issue relates to core concepts
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants