WayofTime / BloodMagic

The place where all of my mod stuffs is!
Other
295 stars 271 forks source link

Standard filter stacking #2041

Open DadamaldaDad opened 4 weeks ago

DadamaldaDad commented 4 weeks ago

Issue Description:

Found in Stoneopolis modpack, tested in an instance with just Blood Magic, Patchouli and JEI and still happens There is a problem with stacking standard filters. When you unstack two filters, they are still linked in a buggy way. I'm guessing this bug has to do something with pointers.

What happens:

When two filters are unstacked, only the one in the original slot gets affected.

What you expected to happen:

The two filters should behave seperately

Steps to reproduce:

  1. get a stack of 2 standard filters in the hotbar
  2. set items in both filters while they are stacked in one slot and close the GUI
  3. split the stack into another hotbar slot using right click in the inventory GUI
  4. open the second filter GUI and change something
  5. close the GUI and watch the first filter being affected and the second one not

Affected Versions (Do not use "latest"):

stellanera98 commented 1 week ago

When you open the filter gui with a stack of fresh filters it sets a uuid for the stack. when you then move one of the filters to another slot and open the gui there it has a uuid and doesnt set a different one. when you then exit the gui the saving process looks through your inventory for that uuid to actually save the changes to the stack in your inventory, since that only holds a copy (i think) so the changes are always saved to the first stack in your inventory with that uuid. The good news is your hotbar are the first 9 so if you put the already set filters somewhere that isnt the hotbar or more to the right on the hotbar you can still edit the other filters normally.

Since I dont think you can move the filter with its gui open maybe adding the slot number to the buffer instead of the uuid stuff might work

DadamaldaDad commented 1 week ago

I feel like it's kinda weird to use an uuid and save the data elsewhere, when you can save it as item NBT. I would like to know a reason for why it's stored like this, but thanks for the response, I got really annoyed by this at first and even stopped playing.

stellanera98 commented 1 week ago

The UUID is stored as item NBT. It seems like the uuid is used because the itemStack the gui knows about is not the same as the one in your inventory because of how minecraft handles things. This means there needs to be a way to figure out which item you used to open the gui to save it there (which is done using NBT too)