Can a name be used to change mob drops?

Discussion in 'Plugin Development' started by KillerPike, Oct 12, 2017.

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

    KillerPike

    Hello everyone, I’m a newb at this sort of stuff, I haven’t even got my workspace setup yet fully. Probably expect some more questions from me soon.

    I read the rules and this seemed alright, sorry if it’s not.

    My question is, let’s say I have a sheep. Sheep drop wool. Let’s say I name this sheep Bob.

    Is there a way to make it so either

    A; when sheared the wool will have the name ‘Bobs wool’

    Or

    B; When killed will have the name ‘Bobs wool’

    Can this be done in plugins or will it take a mod?

    Thanks everyone.
     
  2. Offline

    MightyOne

    This is very much realizable with a plugin, there is a way to do it. Is this a satisfying answer?
    Ok lets skip this unnecessary nitpicking. AFAIK the EntityDeathEvent provides a method named getDrops() which lets you edit what ItemStacks (not Items) an entity drops.
    So I rememberes that there is a PlayerSheerEntityEvent but it looks like you can not modify the drops there :(
     
    Last edited: Oct 12, 2017
  3. Offline

    Zombie_Striker

    @KillerPike @MightyOne
    Though you cannot directly change the drops, you can cancel the shear event, set the sheep as being sheared, and then drop the items you want. Its a bit hacky, but it will work.
     
  4. Offline

    MightyOne

    Last edited: Oct 12, 2017
  5. Offline

    KillerPike

    Thank you everyone for the replies. I’m very glad to hear it’s doable.
     
  6. Offline

    Iran

    Mark this as solved if your issue is resolved.
     
Thread Status:
Not open for further replies.

Share This Page