Solved Aesthetic Leads

Discussion in 'Plugin Development' started by Technes, Aug 12, 2013.

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

    Technes

    I'm unsure of whether or not this is possible.
    On here, it looks like it might be, but I'm also unsure of how to properly execute it --
    and without further adieu:

    Is it possible to have a lead extend from one leash hitch to another leash hitch, i.e. fence post to fence post? I'd like to have the ability to do this for aesthetic purposes, thus I'm wondering if it's possible and how I might go about doing it, if so.

    Thanks.
     
  2. Offline

    toothplck1

    Leashes require 1 living insentient entity to exist, so two nonliving entities cannot be leashed directly to eachother.
     
  3. Offline

    Technes


    Ah, okay. Thanks for clarification.
     
  4. Offline

    NathanG_

    Technes Even though it does require at least one living entity, you could theoretically spawn an invisible entity where you're wanting it to connect to, thus creating an "aesthetic lead."
     
  5. Offline

    Technes

    I found that setting a bat as the leash holder allows you to make a lead/leash connection longer than the default length, without it breaking (not sure if this is possible yet through the leash API). With this in mind, I was able to sort-of replicate what I needed!

    From the user end, all I need to do is make sure the end with a bat is placed well under the ground to avoid bat noises and such.
    Code:JAVA
    1. //----------/// ROPE ///----------//
    2. if (command.equalsIgnoreCase("rope") && p.isOp())
    3. {
    4. Location loc = p.getTargetBlock(null, 256).getLocation().add(0, 1, 0);
    5.  
    6. loc.getBlock().setType(Material.FENCE);
    7.  
    8. LeashHitch leash = p.getWorld().spawn(loc, LeashHitch.class);
    9. Minecart minecart = p.getWorld().spawn(p.getLocation(), Minecart.class);
    10. Bat bat = p.getWorld().spawn(p.getLocation(), Bat.class);
    11.  
    12. minecart.setPassenger(bat);
    13.  
    14. bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 100000));
    15. bat.setLeashHolder(leash);
    16. }
     
Thread Status:
Not open for further replies.

Share This Page