TheIllusiveC4 / Curios

Minecraft Mod: A flexible and expandable accessory/equipment API for users and developers.
https://www.curseforge.com/minecraft/mc-mods/curios
Other
173 stars 66 forks source link

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

Closed Jamalam360 closed 3 weeks ago

Jamalam360 commented 1 month ago

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.

TheIllusiveC4 commented 1 month ago

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.

Jamalam360 commented 1 month ago

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))
                                                  )
                                            )
                                      )
                                )
                          )
                    )
              )
        );
TheIllusiveC4 commented 3 weeks ago

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.