refinedmods / refinedstorage2

Refined Storage is a mass storage mod for Minecraft that offers the player a network-based storage system, allowing them to store items and fluids on a massively expandable device network.
https://refinedmods.com/refined-storage
MIT License
155 stars 16 forks source link

[fabric] Incompatibility with Storage Drawers mod causing lost items #699

Closed swe3per closed 3 weeks ago

swe3per commented 4 weeks ago

Describe the bug

RS_bug Connect the RS terminal to the drawer controller externally, place the coal block in the 2x compression drawer, connect the output cable to the furnace configuration to output the coal, and when the furnace coal is filled to 64, all items in the compression drawer will be emptied. Storage Drawers-fabric-1.21-13.7.1/13.7.2

How can we reproduce this bug or crash?

Connect the RS terminal to the drawer controller externally, place the coal block in the 2x compression drawer, connect the output cable to the furnace configuration to output the coal, and when the furnace coal is filled to 64, all items in the compression drawer will be emptied. RS_bug Storage Drawers-fabric-1.21-13.7.1/13.7.2

What Minecraft version is this happening on?

Minecraft 1.21.1

What NeoForge or Fabric version is this happening on?

0.16.4

What Refined Storage version is this happening on?

refinedstorage-fabric-2.0.0-milestone.4.7.jar

Relevant log output

No response

jaquadro commented 4 weeks ago

This was also filed on the SD side and I'm going to look into it as a potential SD issue.

But given the complex packaging of this mod, would any RS devs offer some guidance in how I can pull this mod into my IDE environment? A modImplementation against the main fabric jar doesn't seem sufficient .. I'm not sure it handles the embedded jars correctly.

Nodrance commented 4 weeks ago

There's a discord in the readme, you're more likely to get realtime help there.

Also there's only like 1.5 RS devs, it's all raoul, and darkere helps a bit with tests and stuff

raoulvdberge commented 4 weeks ago

Hi @jaquadro, you can check an example of an addon mod including RS here:

https://github.com/refinedmods/refinedstorage-jei-integration/blob/develop/refinedstorage-jei-integration-fabric/build.gradle.kts#L45

You also need to add the maven repository from L6-11.

I'll also try to reproduce this on my end, because chances are high this is an RS issue.

jaquadro commented 4 weeks ago

Thanks for the tip. I'm tied up for the next week so I'll look at it after, unless you determine it to be an RS issue before then.

raoulvdberge commented 3 weeks ago

@jaquadro I've been debugging this, and at first sight it appears like a Storage Drawers issue.

It's fairly easy to repro like this: Image

Just put 1 coal in the drawer, and try to extract it from the grid. You'll see it extracts nothing and just voids the resource.

I've been debugging in FabricStorageExtractableStorage (which is the class in Refined Storage that is responsible for eventually extracting from the connected inventory) and I'm noticing the following:

I'm thinking it's not respecting the transaction rollback or something?

Hope this helps a bit with your further investigation.

(FYI You should also be able to just dump the RS2 Fabric jar in your mods/ folder in dev - I've done the same for Storage Drawers and it seemed to have worked)

raoulvdberge commented 3 weeks ago

A few suspicious things I've noticed in the SD code:

jaquadro commented 3 weeks ago

The fabric support is very new and only tested against hoppers so far, so not really a surprise if I've got something wrong. I'll take a closer look at your leads when I'm back in a week, thanks for providing them.

As for the FYI at the end, I did think to try this, and then I specifically didn't because I remember it used to be an issue with this mis-mapping in names. But I'm pleasantly surprised to see it's working, and it is unpacking the internal jars correctly which the flatmap repo wasn't doing.

raoulvdberge commented 3 weeks ago

Awesome! I'll close this on my end for now, but feel free to comment again and I'll reopen.