CraftBook 3

CraftBook 3

139k Downloads

Custom Heads from HeadDrops *sometimes* do not stack

tejashah88 opened this issue ยท 1 comments

commented

Versions

CraftBook version: 3.10.2
Bukkit version: git-Paper-253 (MC: 1.16.3)

Describe the bug
Sometimes the heads dropped from mobs do not stack. Initially it seemed random since I'd have a half stack of Enderman heads and another 3/4ths stack of the same mob that won't mix with each other.

image

However, when I took a closer look at the NBT data (wiki reference) on the heads, I noticed that after decoding the base64-encoded JSON value from the Value field, the only thing that makes the heads different from each other is the timestamp field, which is optional according to the wiki. Additionally, the Signature fields were also different.

For example, I chose two stacks at random and parsed through the NBT data and got the following two JSON values from the Value field:
1.

  • Base64 encoded JSON from Value:
    ewogICJ0aW1lc3RhbXAiIDogMTYwNzcxMzMyMDEzOCwKICAicHJvZmlsZUlkIiA6ICI0MGZmYjM3MjEyZjY0Njc4YjNmMjIxNzZiZjU2ZGQ0YiIsCiAgInByb2ZpbGVOYW1lIiA6ICJNSEZfRW5kZXJtYW4iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWIwOWEzNzUyNTEwZTkxNGIwYmRjOTA5NmIzOTJiYjM1OWY3YThlOGE5NTY2YTAyZTdmNjZmYWZmOGQ2Zjg5ZSIKICAgIH0KICB9Cn0
  • Decoded JSON from Value:
{
  "timestamp" : 1607713320138,
  "profileId" : "40ffb37212f64678b3f22176bf56dd4b",
  "profileName" : "MHF_Enderman",
  "signatureRequired" : true,
  "textures" : {
    "SKIN" : {
      "url" : "http://textures.minecraft.net/texture/1b09a3752510e914b0bdc9096b392bb359f7a8e8a9566a02e7f66faff8d6f89e"
    }
  }
}
  • Signature:
    gPbfswFl20j5lw+/tuLe4nfYVtv6E6qmxatc57k+Aj9hmOXulvbQ3pwn5OFXRXdxORoenaJeNka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343952383,
  "profileId" : "40ffb37212f64678b3f22176bf56dd4b",
  "profileName" : "MHF_Enderman",
  "signatureRequired" : true,
  "textures" : {
    "SKIN" : {
      "url" : "http://textures.minecraft.net/texture/1b09a3752510e914b0bdc9096b392bb359f7a8e8a9566a02e7f66faff8d6f89e"
    }
  }
}
  • Signature: sjlk5Ejx0tBzbOR5jmJLY05GOf7rRTxDjeTgTYrrcERGnKi9j63cECtkHgi+y72KFbgr/uvm6TK29eD0VzSzowHmrUCS+4Y3IgNQGM0YWRGKZXjjmsuQcG9XvwL8y/v9dHqifo/JYyKmRbZUp/ZXH5Z8P3iWzJ+/3E0tHZQwhfcaYnTVoRk23NFXl2py+CVBy26lbHrK99kF38e/IvCGHJWYnKfQRmfGnNkbYq9sJghkpPkX8LEVAe5KdapkrQrdb3bnpb9qxAXRJE4GNfcPE+6gtFLoePRGVGI944kzkI3wIUleuC9gtXWInWynxfdPPASGtfZihuCkddLB2DR1ww/aL9wq1O4g/ZlW9h1JQR89HlkMeDGTcCyZLfPexM4N6y//y8UgEGGQqXX3+NKbTG7kdl1fXWnpnPLNB7jYtaUy8sF2zdM6HIswTgEP9aylFNz9dZYHhAKeZV2Xj9QbGbP/LRB0GodlNzUiDzAh+ZZ7c0zR8JRbJb1HMjXQKbz3guLRzdx1NdsMpEJl8Rp+Ff+MJllRKoqAsTnMo0nk3nQqEJVuhAH3sLfdnBUPxJUPy8Unz3cC7xEM2NTgYu0sboHICQxtSSZ2O+LZq1OeJf0wd+CVehr3BchlpMAtBBGE34vVdoJHbcoB33wOLXNv71JIEvJ1HgGWiZuXSfMJifU=

When looking at the timestamps, they translated to 2020-12-11 19:02:00 and 2020-10-22 05:19:12 respectively. It seems that the timestamp is generated based on "roughly" when a player kills a mob, but it's no more than a guess. My recommendation would be to delete the timestamp from the Value field and the Signature field since they are optional.

To Reproduce

  1. Kill a lot of mobs of the same type over a long period of time.
  2. Check the NBT data with /data get entity [playername] Inventory or a similar command

Expected behavior
All mobs heads from a single mob should consistently stack.

commented

This is a bug in the way Spigot handles head items.

This is already resolved in CraftBook 5 by using the Paper API.