1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Is it possible to get an enchantment name by Enchantment ID

Discussion in 'Development' started by LyricalLyfes, Mar 10, 2021.

  1. LyricalLyfes

    LyricalLyfes Spider Jockey

    Messages:
    28
    Title says it all
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    It is totally impossible, you can not map a string to number.
     
    minijaham likes this.
  3. Mcbeany

    Mcbeany Spider Jockey

    Messages:
    33
    GitHub:
    mcbeany
    PHP:
    Enchantment->getName();
    ?
     
    Primus likes this.
  4. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Agreed with Primus. There's totally not a way to get the enchantment name from an id.

    Edit: I did some investigations and it turns out(or I couldn't find it) that there isn't a way to get the name of the enchantment by id. (correct me if I'm wrong)

    So alternatively, you can just look at pocketmine's source https://github.com/pmmp/PocketMine-MP/blob/stable/src/pocketmine/item/enchantment/Enchantment.php
    and find it out yourself.
     
    Primus likes this.
  5. LyricalLyfes

    LyricalLyfes Spider Jockey

    Messages:
    28
    Alright thanks to everyone who replied
     
    Primus likes this.
  6. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    Simply use PhpStorm and look at the autocomplete or read the specific code om github.com :)
     
  7. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Why bump an already-solved thread? And what you've said about IDE having auto complete won't solve his problem.
     
  8. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    Bruh use (Solved) Tag pls
     
  9. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.