[SPIGOT-3077] ItemStack#isSimilar returns true for skulls with different textures Created: 19/Feb/17  Updated: 19/Feb/17  Resolved: 19/Feb/17

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Phoenix616 Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: bug, nbt
Environment:

 

 



 Description   

When calling ItemStack#isSimilar on two skull items with different textures applied it will return true. This is probably because the skull texture and owner-UUID aren't implemented in the ItemMeta yet and will probably happen for every item with no ItemMeta implementation. (Not sure which these are) It might be beneficial to find a more robust isSimilar implementation to ensure that future NBT additions don't show similar behaviour.

Example comparision:

ItemStack{SKULL_ITEM x 1, SKULL_META:{meta-type=SKULL, internal=H4sIAAAAAAAAAE2OzU6DQBhFP01MkPgYbkmmMIWycGGE0CFlEAoU2PEzWNqZ2lAwTJ/KR5Sli7u4OecmVwVQ4WV/njj/HL67njMFHkkLrww1pm21ltbVJtKwvUFaxVir1bg1MLZYtdF1FdRldGXD2LPbMygjm8dpYDcVAB4UeMoqPjH4ZdJHZX5Ebe7zRhJz6cke8ZCcrha5ZLL+ICYRC9++mztp/3PXY3VY88Lwj+UlmmqRoZ0Rc7aNV41IfwoRGaUToTL50qkT4SI564UgqyUy0FNJPVcGB1enp6yndypCJ124OwdezKnjC5o0RnEvcOgFc5i4uOx9u8vR2/Ie/gB7xc86GAEAAA==}} equals ItemStack{SKULL_ITEM x 1, SKULL_META:{meta-type=SKULL, internal=H4sIAAAAAAAAAE2PzU6DQBRGryYmSHwMtyRTYDBddGGkoUPKIC3QMjt+LqEwYENBoc/lA8rS5ZdzzuJTAVR4OTajlJ/9V3mRqMAjK+CV5gZmpo4aNVNTMw3MtZTSQistE3WdoEFpqoK6RFfshwvenkEZcBrGHm8qADwo8BSnckT4xdkl4lyR4uzKfGbWssMjkT6rr2+si+fsg1msXfju3drP638uHdITlYnhVqILxqyNyd44SNwdVnkbfYtaVr6dGF4d6V6YzMKJJXd45YfNxO854Y5o/ZCZvu3WSbidfSeivGaUt8lPctoSz44m0bqV5wSE1/ldhLJh3WpdBpvN8gD+ADoLhdUcAQAA}}: true


 Comments   
Comment by Phoenix616 [ 19/Feb/17 ]

That's strange, I used the items given via the commands provided in my previous comment. I'll look into it some more.

Comment by md_5 [ 19/Feb/17 ]

Cannot reproduce using the Minecraft give commands.

        if ( event.getMessage().equals( "/test" ) )
        {
            ItemStack one = event.getPlayer().getItemInHand();
            ItemStack two = event.getPlayer().getInventory().getItemInOffHand();
            getServer().broadcastMessage( one + " " + two + " " + one.isSimilar( two ) );
            
            event.setCancelled( true );
        }


[10:09:50 INFO]: ItemStack{SKULL_ITEM x 1, SKULL_META:{meta-type=SKULL, internal=H4sIAAAAAAAAAE2OzU6DQBhFP01MkPgYbkkGBlAWLmqN7ZAO2BYYmB2UQX6G2rSgZZ7KR5Sly5tzTnJ1AB0e9t0o5cf5q2qk0OCWlPDolNjJC2EbqCqeDYws2yhdjA3Lcy3b8crKzF0d9Dk6ifPQiMs9aIO4DuNZXHQAuNHgLsnlKOBXTD7iaY3K1JeHibjzjvZIhqQ9PZFjMhVL4pJ+5uuFu5m8f64z5MyRGfZrftyORZ+gDd5Jsd6Zhz7+Dhnv6CpWVL3WQftp87e6ydrOpJFsOOOSMr/PFEVUUZy1FFP23gYqvgbRYqIR7/lq+0NVZ4YsaQKLoGDpe1WKXub38AexJO6wGAEAAA==}} ItemStack{SKULL_ITEM x 1, SKULL_META:{meta-type=SKULL, internal=H4sIAAAAAAAAAE2Py06DQBiFf01MkPgYbkmGe1m4qKZpmRTQluvsgJkJl6E2LRjguXxAZ+nufDnfWRwVQIWXcz8J8Xn75q1gCjz6FF4RtTn1alOjyLI0y91wrXJdS6OmW9l84/DSKFVQ5ejKbmPL7s+gjGwepxu7qwDwoMBTWoqJwS9bMCJ5g2iORb34juT4jETkd1fXv6RL9eE7/iD7w9Y5Lt4/1x7LzBaFiRty+ZqqIUVH8yTY4aTXQ/JDYtwGa9qS/U4nGe5Jt1vDrEAkrufCSFAU10s4kJZkgR6ugU2694bsU+lt52JN5ihLliJLm9Ao9CDu9UDmoMUez9GbfAB/cdIxvRwBAAA=}} false

If you think there is a Spigot API bug then you need to provide specific reproduction code. The example you have given cannot be observed and suggests that the plugin you are using is not parsing or applying textures correctly, and is likely incorrectly using NMS to do so.

Comment by Phoenix616 [ 19/Feb/17 ]

This error can be observed when giving yourself skull items via EssentialsX' give command. E.g. with these two commands:

 

/give @p skull 1 3 {SkullOwner:{Id:"0d5fd9c3-d044-478f-b774-d37b5f86fa2a",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTJiMzViZGE1ZWJkZjEzNWY0ZTcxY2U0OTcyNmZiZWM1NzM5ZjBhZGVkZjAxYzUxOWUyYWVhN2Y1MTk1MWVhMiJ9fX0="}]}}}

 

/give @p skull 1 3 {SkullOwner:{Id:"5d35abe4-0fb8-3024-d633-2962459df1a6",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkMGUzMzBhNjg4ZDhiYjk1MTliZWZlMWJmYzM0MzM3YjM3MWFjNzUxNTAyMTZmZGQwMzk1OWViN2I0NCJ9fX0="}]}}}

 

 

 

Generated at Thu Apr 03 15:54:39 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.