Different item id with enchanted items #1204


  • Enhancement
Open
  • _ForgeUser9373025 created this issue Mar 13, 2017

    same enchantet items have a different item id when items combine in a anvil

     

    example:
    5 items with the same enchantments (example Efficiency 5 Unbreaking 3) can have 5 item ids ... and then i need 5 chestshops for this items with the same enchantments

     

    https://github.com/dmulloy2/ChestShop-3/issues/19

  • _ForgeUser9373025 added the tags Defect New Mar 13, 2017
  • Phoenix616 posted a comment Apr 4, 2017

    This probably happens due to them having different ItemMetas as enchantments can be in a different order and the items itself could have different repair cost values. Only the first case could really be solved (by using a consistent order of the enchantments for all items) but not the second one.

     

    To help figure our which one is really your issue you can provide more information about the items, the full NBT data of it would be good. (E.g. via the .dat file of a player with all of them in their inventory)

     

    A workaround could be to just create a shop with the item id without the special id.


    Edited Jun 18, 2020
  • Phoenix616 removed a tag New Apr 4, 2017
  • Phoenix616 added a tag Waiting Apr 4, 2017
  • Phoenix616 edited title Apr 4, 2017
  • _ForgeUser9373025 posted a comment Apr 4, 2017

    You can easy reproduce this issue.

     

    1. create some enchantments only with a enchantment table

    2. create the same items with the same enchantments with books in a anvil

     

    Now you will see, the same enchantments on the same items can have a different ids.


    Edited Apr 4, 2017
  • BillyGalbreath posted a comment Apr 26, 2017

    This bug is due to the nbt for repair cost (value changes when used on anvil). The fix is simple, use a custom item compare method that does not include such arbitrary things such as repair cost, rather than bukkit's isSimilar method.


    Edited Apr 26, 2017
  • Phoenix616 posted a comment Apr 27, 2017

    The fix is simple, use a custom item compare method that does not include such arbitrary things such as repair cost, rather than bukkit's isSimilar method.

    No it's not that simple. That way it would allow you to sell items that are different from what the shop accepts. (E.g. sell unrepairable tools where the shop wants repairable ones) Same goes for buying items, when the shop offers items with a low repair cost then the player should also get only ones that have a low repair cost. Another problem would be the programmatic meaning of the ids: they serve as the database key for the item information. There is no way to generate the same key for two items that aren't the same without having to loop and compare all the already registered items.


    Edited Apr 27, 2017
  • Phoenix616 removed a tag Waiting Aug 17, 2017
  • Phoenix616 removed a tag Defect Sep 25, 2017
  • Phoenix616 added a tag Enhancement Sep 25, 2017

To post a comment, please login or register a new account.