Shoulder Surfing Reloaded

Shoulder Surfing Reloaded

20M Downloads

[3.2.0-1.19.2] Game crash on joining world while holding an item in 'adaptive_crosshair_hold_items'

zaeonNineZero opened this issue ยท 8 comments

commented

Description

When loading a game with an item defined in adaptive_crosshair_hold_items in the client config, the game will crash before the player can load into the world. This happens with both vanilla items (i.e. snowballs) and modded items. From the crash reports, it appears that ShoulderRayTraceContext.from is receiving a null entity parameter for some reason; the call entity.getEyePosition on line 11 throws a game-crashing error because of this null parameter.

This does not occur on 3.1.0. The crash only occurs the first time a specific world is loaded in Minecraft - if you load a world without an adaptive crosshair item in hand, then switch to one and reload the world, the crash will not occur.

It seems the best fix to start off with would be to add a null check to ensure the entity provided to ShoulderRayTraceContext.from is valid.

Steps to Reproduce

  1. Open or create a Minecraft world.
  2. Hold a snowball or an egg. (These should be defined in adaptive_crosshair_hold_items by default)
  3. Close Minecraft, then relaunch the game.
  4. Attempt to open the world where you're holding the snowball or egg.

Result: The game should crash with an Unexpected Error: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.Entity.m_20299_(float)" because "entity" is null

Minecraft version

1.19.2

Game Logs

https://mclo.gs/hGdMY99

Additional Information

Relevant crash log: https://mclo.gs/X0p28N7

This issue has been confirmed when running Forge 43.2.6 and 43.3.9.

commented

Edit: see comment below, resolution only worked for a short period of time

Resolved

Updating to Forge 43.3.9 resolved this issue. I will reopen the issue or link back to it if the problem re-appears.

commented

Reconfirmed on Forge 43.3.9 for 1.19.2, reopening the issue and updating the description.

commented

Using your config, I was able to reproduce the issue, thanks! The refactoring seems to have solved the issue on my end. I'll await your feedback to make sure it is fully resolved.

commented

Compiled the latest commit and attempted to test it, but the game failed to load citing a mixin injection error.

Should work now if you pull and compile again (force pushed a fix).

I first encountered the crash after adding several items to the adaptive_crosshair_hold_items list in the client config.

Thank you, I will try again.

commented

Thank you for the report. Unfortunately, I was not able to reproduce the issue, although the fix should be pretty obvious. I am currently in the process of refactoring the codebase, which has now reached the 1.19.2 branch. It would be very helpful if you could compile the repository based on the latest commit 2541b1c (checkout branch 1.19.2) and tell me if the issue is already fixed, as the initialization process has also been reworked.

commented

Compiled the latest commit and attempted to test it, but the game failed to load citing a mixin injection error.
Here's the crash log:
https://mclo.gs/gYyJSql

commented

To add some further clarification - I first encountered the crash after adding several items to the adaptive_crosshair_hold_items list in the client config. Since the crash was only occurring when holding items in that list, I wonder if I made a formatting error somewhere, or if the regex expressions were causing other issues that led to the crash.

I've attached the client config as a .txt file for you to take a look at.
shouldersurfing-client.txt

commented

The refactor appears to have resolved this issue for real this time, but I'll let you know if it re-appears again.

In the meantime, the refactor also seems to have broken the CGM compat (the mixin where recoil is applied to the shoulder camera). I'll open a new issue regarding this.