Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Item Signature Updates on Inventory Movement Preventing Stacking #11753

Open
VinceSMC opened this issue Dec 19, 2024 · 8 comments
Open

Comments

@VinceSMC
Copy link

Expected behavior

When moving a custom item inside the inventory, the custom signature of the item should remain unchanged, ensuring the item can stack with other identical items without issue.

Observed/Actual behavior

When moving a custom item within the inventory, the custom signature is updated. While the item's visible properties (e.g., display name, lore) remain identical, the updated custom field prevents it from stacking with other items.

Steps/models to reproduce

  1. Create a custom item that has a custom signature.
  2. Place the item in your inventory.
  3. Move the item to a different inventory slot.
  4. Inspect the item's data.
  5. Compare the custom signature before and after moving the item.

Plugin and Datapack List

Image

Paper version

This server is running Paper version 1.21.3-81

Other

No response

@electronicboy
Copy link
Member

custom signature?

@VinceSMC
Copy link
Author

custom signature?

Metadata

@electronicboy
Copy link
Member

You're going to need to provide more information, such as means of reproduction and how you're adding that data, I'm not going to run an interrogation

@dawon
Copy link
Contributor

dawon commented Dec 19, 2024

If any property of two items except the amount is different then the items cannot stack. Not much you can do with that, because by stacking the two stacks become one and the conflicting data would be lost...

The only way I can think of is to manually handle inventory operations and stack the items manually, while preserving how big part of the stack is marked which way... But I wouldn't go that rabbit hole....

@VinceSMC
Copy link
Author

VinceSMC commented Dec 19, 2024

The data is being automatically generated for the item when using custom attributes like a textured head.

This is the data of an example item, the only difference is a slight change in the custom data. To be specific:

Data 1:
H4sIAAAAAAAA/83Uz27TMBwHcA8VkZWXsMK1QqGlRavEAY2tc9SkrOu/BCHk...
Data 2:
H4sIAAAAAAAA/83Uz27TMBgAcA8VkZWXsMK1QqGlRavEAY2uc9SkrOu/BCHk...

These are nearly identical but differ at specific characters, such as "MBw" in Data 1 vs. "MBg" in Data 2.
This change only happens when moving the items around in your inventory making them unable to stack again.

@electronicboy
Copy link
Member

stack1

Gzip
Compound ""
        Compound "display"
                ...
                End
        Compound "SkullOwner"
                String "Name" ""
                IntArray "Id" 4
                        0
                        1231420745
                        -1
                        -1073674128
                Compound "Properties"
                        List "textures" Compound 1
                                        String "Value" "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmU0NzNjNzdiZWJmMjExNjI3OGQxY2I4YjkyMWZjM2YzY2RjZGMzZTUxMTg5N2EzMjJlOWI3MGEyOGJiYmZlYiJ9fX0="
                                        End
                        End
                End
        End
End

stack2

Gzip
Compound ""
        Compound "display"
                ...
                End
        Compound "SkullOwner"
                Compound "Properties"
                        List "textures" Compound 1
                                        String "Value" "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmU0NzNjNzdiZWJmMjExNjI3OGQxY2I4YjkyMWZjM2YzY2RjZGMzZTUxMTg5N2EzMjJlOWI3MGEyOGJiYmZlYiJ9fX0="
                                        End
                        End
                IntArray "Id" 4
                        0
                        1231420745
                        -1
                        -1073674128
                End
        End
End

So, ItemMeta looks to be stripping data from the skull, in part due to the skull not being properly populated with data

@VinceSMC
Copy link
Author

Apologies for the delay in responding. After some digging, I’ve found the root cause of the issue. It seems that the bug occurs when joining the server using the Fabric Loader mod.

To help illustrate the problem, I’ve made a screen recording: https://imgur.com/a/9vT6Y9G

@VinceSMC
Copy link
Author

Appears to be a problem with ViaVersion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants