branchpanic / stockpile

A Minecraft mod all about storage.
MIT License
10 stars 5 forks source link

Crash when placing Stockpile barrel next to a UC Conveyor #86

Closed falkreon closed 5 years ago

falkreon commented 5 years ago

Sorry to put this on your plate, I know you're busy, but we got a crash log that points here.

The Crash https://paste.ee/p/Jt3Q9

Forwarding this issue from https://github.com/CottonMC/UnitedConveyors/issues/2 after careful study of the crashlogs and circumstances.

Steps to Reproduce Place a barrel in front of a United Conveyors conveyor. The crash happens immediately.

Why it Happens The front face of a United Conveyors conveyor is an EmptyItemExtractable.SUPPLIER. This exists to tell inspectors, "This face of the block pushes items out of it, but can't be extracted from, and may not have an internal inventory at all." It will always return ItemStack.EMPTY on an extraction attempt.

FixedMassItemInv.attemptAnyExtraction appears to test this empty ItemStack against a ConstantItemFilter, which crashes the game per LBA's rules for that filter.

Next Steps I'm closing the issue over at my end, but I'll also fire a note off to AlexIIL who writes LBA to see if the existing/builtin AttemptExtraction methods might fall prey to this, and find out whether the crash-on-empty-stack-test is strictly necessary.

branchpanic commented 5 years ago

Thanks for the detailed issue! Stockpile's LBA implementation is sketchy at best but for the time being I should be able to short-circuit if there's an empty stack. I wasn't aware of this restriction on IItemFilter so hopefully adding in this case will resolve the issue.

branchpanic commented 5 years ago

Fix was very simple as I'd suspected. Pushing 1.1.1 momentarily.