Solved Changing enchantment description?

Discussion in 'Plugin Development' started by Froshin, May 19, 2013.

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

    Froshin

    I was wondering if there's any way to change the description of the actual enchant. Please do not confuse this with the lore or the DisplayName. :)

    Because currently it says:
    "Efficency enchantment.level.25" in grey color, and I would very much like to change that to something custom.


    Thanks in advance!
     
  2. Offline

    Craftiii4

    Not sure if its possible, I know you said about lore :p, but have you tried clearing the lore?
     
  3. Offline

    Froshin

    Craftiii4

    You mean like so?

    Code:
    im.addEnchant(Enchantment.DIG_SPEED, 25, true);
     
            im.setLore(null);
         
            im.setDisplayName(ChatColor.GOLD + "Terra X");
            List<String> lore = Arrays.asList("A picka...
    Didn't work. :(
     
  4. Froshin
    I think more like this
    Code:
    im.addEnchant(Enchantment.DIG_SPEED, 25, true);
    List<String> lore = new ArrayList<String>();
    lore.add("A pickaxe")
    lore.add(ChatColor.AQUA + "Enchants:")
    lore.add(ChatColor.GOLD + "Digging: " + ChatColor.GRAY + "25");
    im.setLore(lore);
     
  5. Offline

    Froshin

    Sgt_Tailor

    Hi! I already know how to modify lore, that code will unfournately not solve it.
    I wrote a similar code.

    List<String> lore = Arrays.asList(ChatColor.WHITE + "A " +ChatColor.YELLOW + "divine" +ChatColor.WHITE + " pickaxe", ChatColor.GREEN + "Class XV reward"); //ChatColor.GOLD + "Class X"); //List<String> lore = Arrays.asList("A ", "Second Line", "Third Line");
    im.setLore(lore);

    However, the enchantment text remains, even if I set the lore to null after I've applied the enchants.
     
  6. Offline

    Minnymin3

    The enchantment name, AFAIK, is handled client side and is impossible to change.
     
  7. Offline

    TheTinySpider

    Minnymin3 Packets!
    Froshin Try looking in ProtocolLib to handle this, I accualy wanted todo the same a while ago, I did it so the client would recive an item with the "new" enchantment lore, and changing the packet to not send the enchantment to the client.
     
  8. Offline

    Minnymin3

    Im quite sure there is no packet for that. http://mc.kev009.com/Protocol
     
  9. Offline

    TheTinySpider

  10. Offline

    Minnymin3

    TheTinySpider
    That just changes the inventory not the 'lore' added by the enchantments. Im not sure but I think that, from my skimming through it, the HideEnchantmentListener does not actually hide the enchantments but removes the enchantments clientside.

    This DOES work I believe, but you won't have the enchantment glow.
     
  11. Offline

    TheTinySpider

    Minnymin3 Yea it does removes the glow, but that was what i was going for back then. Anyway you might be able to readd the effect again in the removeal code xD
    Bit complicated, but renaming enchantments is complicated :p
     
    Minnymin3 likes this.
  12. Offline

    Froshin

    TheTinySpider
    Minnymin3

    Thanks for shedding some light on this guys.

    EDIT:

    This API seems to be aiming to simplify this.

    EDIT2:
    Seems he got rid of this particular function because he didn't want to rely on protocolLib
     
Thread Status:
Not open for further replies.

Share This Page