NMS Entity enchanted item and health

Discussion in 'Plugin Development' started by JaySN, Nov 6, 2020.

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

    JaySN

    Im trying to give my custom mob(boss) an enchanted item and give it health. My problem is the setHealth function, seems to not work(or is there something I'm missing) and when I tried converting a BukkitItemStack to asNMSCopy, it get rids of its item meta and enchants.
    Any fix to this?

    Code: https://pastebin.com/3apSRcgA
     
  2. Offline

    Kars

    You are calling this.setHealth so am i right to assume your Pumpkin is an extension of Entity?
     
  3. Offline

    JaySN

    yep, it is an extension of EntitySkeletonStray

    [EDIT]
    I am able to get item enchants now cause I forgot to setItemMeta(rookie mistake), but I still can't figure out the setHealth part.

    Fixed it on my own.
    The solution below for anyone who has the same problem as me(it uses a deprecated method, which is kinda scuffed).
    https://pastebin.com/UTn3Ehga

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 6, 2020
  4. Offline

    Kars

    @JaySN so what is the difference between your first and second method. You set max health first?
     
Thread Status:
Not open for further replies.

Share This Page