Removing the enchantment text from an item, but keeping the enchant on it

Discussion in 'Plugin Development' started by Appljuze, Feb 4, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Appljuze

    Hello. I'm wondering how I would go about removing the text from an item that is enchanted, but yet still keep the enchants on it.

    The only way I could think of without editing nms code would be to listen for the EntityDamageByEntity event and add the enchants when the event gets called, then remove them via a very short scheduler. I tried this out and it didn't work. I assume it's because I'm technically setting the enchant the millisecond after the damage event occurs.

    If the only way to do this is with NMS code, could anyone provide it for me? I'm not familiar with it, so just saying "block the packet from being sent" doesn't help me much :/

    Thanks in advance for any help!
     
  2. Offline

    Jogy34

    My best guess is that you would have to create your own enchantments. I saw a thread on that in the resources section a while back.

    Another alternative would be to figure out how each enchantment specifically works and then duplicate that effect so that you don't actually have to worry about adding and removing the enchantments.
     
  3. Offline

    Appljuze

    But if I create my own enchantments, it'll still put the enchant glow on the item. I don't want that; the item should look normal.
    Do you know how I would go about doing my first idea? With the whole setting the enchants before the damage event.
     
  4. Offline

    NinjaWAffles

    You sure there's no way with NBT? This code found *here* was posted about 9 months ago, but I'd presume it still remains the same seeing as how enchanting hasn't been altered much since then. It's 3 minutes past 11 p.m. where I live, so I'm too tired to actually compile this and see if it works. If someone else would like to, let me know. :)

    EDIT: Would something like *this* help?
     
  5. Offline

    xTrollxDudex

    NinjaWAffles
    Apparently, I completely forgot how NBT works :p

    That should work, theoretically; my thought process:

    Code:
    Ok, go to wiki and find NBT structure for ItemStacks
    |
    ----> Ok, found enchantments
             |
              ----> But if we remove that, we remove the enchantment, hmm.
                                                         |
                                                         v
                                           NOPE. NO WAY TO REMOVE WITHOUT EVERYTHING.
    
    I was wrong, when you remove NBT you don't remove everything with it.
     
Thread Status:
Not open for further replies.

Share This Page