Help with Entity

Discussion in 'Plugin Development' started by Yazan, Nov 28, 2013.

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

    Yazan

    Hello, I currently have 2 questions. Let me explain what I'm trying to do. I want to spawn in a snowman when a command is executed and then edit that snowman's snowball power (Like is there a SnowballThrowEvent/ProjectileThrowEvent or something) I want to get the player the snowball hits and do things to the player.
    Second this is I want to know how to make the snowman hostile, setTarget(PLAYER); doesn't seem to work.
    Here's my class so far:
    Code:java
    1. if(cmd.getName().equalsIgnoreCase("spawnsnowmantest"))
    2. {
    3. Player p = (Player)sender;
    4. final Snowman IcicleSnowman = (Snowman)p.getWorld().spawn(p.getLocation(), Snowman.class);
    5. IcicleSnowman.setCustomName("Icicle");
    6.  
    7. IcicleSnowman.setTarget(p); //Doesn't seem to work.
    8. p.sendMessage("spawned a snowman.");
    9. //too lazy to write more advanced or better code since this is just a test.
    10. //now here is where I'm stuck.

    xTrollxDudex Maybe you could help c;
    Any help would be appreciated. Thanks!
     
  2. Offline

    Aperx

    Yazan look at the ProjectileHitEvent for your first issue
     
  3. Offline

    Yazan

    Anyone please?

    Oh yeah thanks :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  4. Offline

    xTrollxDudex

    So solved?
     
  5. Offline

    Yazan

    No, there's point 2, to make snowmen hostile. Thanks for replying :D
     
  6. Offline

    xTrollxDudex

    Yazan
    Snow golems can't be made hostile... You will have to mess with a bit of NMS to get that to happen, and modify a few goals to make the snow golem actually throw the snowball at the player you made the snow golem hostile to.
     
  7. Offline

    Yazan

    Oh crap not NMS ;/ I'll try the best I can do then get back to you.

    chasechocolate can you please help me? I know you are very experienced a helpful.

    I wish I could find a good tutorial to learn packets and NMS, I really can't find any except for trolldude's tutorial :/ (I don't mean it's a bad tutorial but I can't really understand it)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  8. Offline

    Yazan

    Anyone...? Please?
     
Thread Status:
Not open for further replies.

Share This Page