Curios API (Fabric)

Curios API (Fabric)

819k Downloads

[Feature]: Allow Datafixers to Run on Items in the Curios Inventory

Jamalam360 opened this issue · 3 comments

commented

What is the new feature or improvement?

I'm currently updating my mod from 1.20.4 to 1.20.6 and have written a datafixer to upgrade NBT on my items to components. I noticed that DFU doesn't run on items in the Curios inventory.

@Patbox created a 1.20.6 Trinkets update PR which includes this mixin with the description Trinkets injects here adding support for basic datafixing in case of other mods supporting it or just general vanilla nbt format changes..

I am in the process of trying to convert that mixin to work on the Curios data format so I can test my own datafixer.

commented

I'm willing to add this, but I've honestly never worked with DFU so I have no idea how they work. That will block my ability to implement this myself until I can learn about it.

I am in the process of trying to convert that mixin to work on the Curios data format so I can test my own datafixer.

If you are able to create a working and tested implementation for Curios, I would accept a PR for this feature.

commented

I was trying to adapt the Trinkets mixin to work on the Curios data format but was unsuccessful. The error messages weren't too helpful.

My format seemed correct from what I could see running /data get entity @s. This is the only copy I have of the code, I had made some other changes but deleted the mixin because it wasn't working:

return DSL.allWithRemainder(original,
              DSL.optionalFields("neoforge:attachments",
                    DSL.optionalFields("curios:inventory",
                          DSL.optionalFields("Curios",
                                DSL.list(
                                      DSL.optionalFields("StacksHandler",
                                            DSL.optionalFields("Stacks",
                                                  DSL.optionalFields("Items",
                                                        DSL.list(References.ITEM_STACK.in(schema))
                                                  )
                                            )
                                      )
                                )
                          )
                    )
              )
        );
commented

I think I figured it out and have included it in the latest version, but let me know if it doesn't work as intended.