Create icon indicating copy to clipboard operation
Create copied to clipboard

Crash when using mechanical press in 1.20, create 0.5.1.f

Open Wyrmlet opened this issue 1 year ago • 6 comments

When making things on a mechanical press in a modpack, I have encountered numerous server crashes when the item was created. After some troubleshooting in https://github.com/TerraFirmaGreg-Team/Modpack-1.20.x/issues/202, it appears that the problem is related to this mod. Server crash log: crash-2024-01-19_18.45.01-server.txt

After looking into it, it seems to me that the issue is caused by this line: https://github.com/Creators-of-Create/Create/blob/2201d87da7744cf9ee3f83e1e4c21643244f342b/src/main/java/com/simibubi/create/content/logistics/depot/DepotBehaviour.java#L147 As it does not check if a player holds an item or not and tries to write something to it, causing a null pointer exception. I suggest adding a check for that, which should be rather straightforward.

Wyrmlet avatar Jan 30 '24 23:01 Wyrmlet

Gah, the github feature to mention a line of code in a new issue bypassed the issue templates. Hopefully that's not a problem.

Wyrmlet avatar Jan 30 '24 23:01 Wyrmlet

The null check happens at https://github.com/Creators-of-Create/Create/blob/a41053b8966edf7bd9732223b18f783fdb52521d/src/main/java/com/simibubi/create/content/logistics/depot/DepotBehaviour.java#L118-L119

Between there and the point of your NPE, none of the code sets heldItem to null without returning out of the function. Fairly confident this is not an issue with Create. You could try a binary search to find the conflicting mod. I noticed open parties and claims in the mixins. Chunk claiming mods can be quite aggressive in what they allow to happen to a chunk, which could be undoing an assumption that Create's code is based on. Is this happening in a claimed chunk per chance and if so can you reproduce in an unclaimed chunk and/or without a chunk claiming mod installed?

VoidLeech avatar Jan 31 '24 16:01 VoidLeech

Huh, it did happen in a claimed chunk. Could be worth it to test that, though that could be problematic since the crash doesn't seem to have a clear trigger, instead only happening... Sometimes. Still, thanks for the help.

Wyrmlet avatar Jan 31 '24 23:01 Wyrmlet

Yeah most likely a issue with another mod/a mod mixining into create and failing to do a null check

IThundxr avatar Feb 04 '24 17:02 IThundxr

I ran into the same problem on my own server. The error is the same as that posted by Wyrmlet. After research, in my opinion, since the code has been executed to Line 147, then the heldItem is not null when the null check part mentioned by VoidLeech is executed. (Translate from Google)

xiaoACE6716 avatar Mar 08 '24 16:03 xiaoACE6716

Hi, if you're using KubeJS it'll interfere with recipes, some modpacks use kubejs to create compatibility with other mods, finding pressing.js in kubejs/server_scripts/reciipes and adjusting it in java will fix this, or try deleting the pressing.js file.

zckrii avatar Aug 08 '24 21:08 zckrii

As seen in https://github.com/TerraFirmaGreg-Team/Modpack-Modern/pull/758, the modpack in question had a pressing recipe that sometimes didn't produce an output: that's where the null item is coming from. (air output becoming null later down the line)

Leaving this open though; this code should either get adjusted to handle not getting any output sometimes, or recipes that aren't intended to have chance outputs need to not get parsed with a chance.

VoidLeech avatar Mar 08 '25 14:03 VoidLeech