Flanks255 / simplybackpacks

Simply Backpacks
MIT License
12 stars 5 forks source link

Missing save in `EntityItemPickupEvent` handling #29

Closed hvdklauw closed 4 years ago

hvdklauw commented 4 years ago

Describe the bug I was debugging a dupe bug with Building Gadgets and ProjectE alchemical bags with black hole ring (Issue) then I also thought to check SimplyBackpacks and ran into a different error: Getting N + 1 items in the backpack. After fixing the bug with ProjectE the result was that with SimplyBackpacks I only got 1 items returned to the bag.

BuildingGadgets throws multiple EntityItemPickupEvent for each block being picked up, I traced through Simplybackpack and came here where the contents of the backpack gets checked to see where to insert the Items in the backpack.

Now I noticed that everytime this block was hit, the code reported "1 air" in the first slot, even through I had hit the code before and it at that point added "1 cobblestone" to the slot. So somehow simplybackpacks keeps it's initial state till building gadgets is done and then it saves the last thing that happened: adding "1 cobblestone". The end result is only 1 cobblestone in the backpack while I expected there to be multiple.

I think there is a save call missing in the event loop and it's happening somewhere later thus it can't correctly store the multiple events.

simplybackpacks version: 1.15.2-1.4.11 Forge: 31.2.31

hvdklauw commented 4 years ago

Should note that PocketStorage does not have this bug :)

The three results from a EntityItemPickupEvent (allowed, denied, cancelled) are really confusing in what it actually means

Flanks255 commented 4 years ago

ill hopefully work on it this weekend.

hvdklauw commented 4 years ago

No hurry.

Also tested pocket storage, and that was working fine :-)

Flanks255 commented 4 years ago

Alright, it might be a bit longer, ive got a incoming PR that should revamp all that code anyway, so hopefully once that gets all merged in and tested we should be good.

hvdklauw commented 4 years ago

Sure, I'll keep an eye out and can test again if needed.

Flanks255 commented 4 years ago

should be fixed in 3960302 uploading to curse shortly