PneumaticCraft pressurized items and armor causing disconnects randomly
GSValore opened this issue ยท 9 comments
Minecraft Version
1.16.3
Forge Version
34.1.42
Mod Version
2.5.0
Describe your problem, including steps to reproduce it
Spuriously, when someone comes near a person on the server who has Pneumatic items or armor (ones that take air), they are kicked due to a LazyOptional error. It does not crash the server, merely kicks the person. The person holding the items is unaffected.
Any other comments?
I modified Forge slightly to help trace and identify this error and an excerpt in the log appeared:
See also #600
That's interesting. I'd seen a similar report a while back, but I was never able to reproduce it. I'd be very interested to know if this happens without Random Patches installed - from your stacktrace, it appears to be doing something with PacketBuffer.writeItemStack()
before my code gets to do a capability check on the item being sync'd.
I don't know why a capability check would otherwise trigger a "LazyOptional is empty..." exception. But if all else fails, I can rewrite that bit of code to check NBT directly rather than using the air handler capability to get the current air levels of the item...
I went ahead and made a change which I'm hoping will help here. If you can, please try out build 67 from https://jenkins.k-4u.nl/job/PneumaticCraft-Repressurized-1.16/ but be aware it does add a few new block & items, so take a backup if you plan to deploy on a live server...
I will test as soon as possible; RandomPatches apparently only alters the maximum packet size according to the bytecode transform so it shouldn't be having a negative impact. There's also a mod in the pack called Scalable Cat's Force which alters LazyOptional but that's via mixin and wraps its code around an explicit check.
Currently, items aren't kicking people as before. However, a new issue appeared. I ended up standing on the station with a chargeable item and it crashed the server.
That's very weird. The charging station finds chargeable items, adds them to a list, then (dis)charges them, all in the same tick()
call. Which implies somehow the itemstack is changing to an empty stack during that operation, which shouldn't be possible (and I haven't been able to reproduce it).
Anyway, I've added a bit more defensive coding, so let's see if that helps...
Give build 69 a go....
(although the filename is marked as 1.16.4, it should run just fine on 1.16.3)
I loaded the update on the server and found it no longer crashed or emitted problems under the same circumstances.