Leash

Discussion in 'Plugin Development' started by xWatermelon, Aug 15, 2013.

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

    xWatermelon

    How can I spawn a leash? I would like to spawn it and attach one end to a player and another end to a FallingBlock.
     
  2. Offline

    mnoco8

    Codewise like a plugin? or a command i have not heard of a leash item yet either but you would edit your inventory such as player.getInventory.additem(Material.Leash) that is what I would do at least. sorry if this is of no help to you :/ :) good luck though :) - mnoco8.
     
  3. Offline

    xWatermelon

    mnoco8 not the item, the entity.
     
  4. Offline

    Technes

    From what I've experienced and read, you aren't able to attach a lead to a sentient entity -- i.e., a player.
    It's sad, but true.

    I think the best you can do is make the player become the passenger of another mob, make that mob invisible, and hook both that mob and the falling sand entity together with a lead.

    As for "spawning in" a leash, something along the lines of...

    Code:JAVA
    1.  
    2. Location loc = p.getLocation();
    3. Bat bat = p.getWorld().spawn(loc, Bat.class);
    4. Minecart cart = p.getWorld().spawn(loc, Minecart.class);
    5. bat.setLeashHolder(cart);
    6.  


    I don't know if you can hook a lead to a minecart, but it's worth a shot, at least for this example.
     
  5. Offline

    xWatermelon

    Technes hmm it seems like it was done here:
     
  6. Offline

    Cirno

    In Java, if there is a will, there is a way. It just probably involves some reflection.

    Anyways, you can try getting the CraftPlayer from Player and then cast CraftPlayer to LivingEntity; I doubt this would work though.
     
  7. Offline

    TheTinySpider

    The iron block you see is probaly a custom entity changed with protocollib into a falling sand entity.
    Look up some more advanced threads in order to see how you do it.
     
Thread Status:
Not open for further replies.

Share This Page