Solved Making straight lines?

Discussion in 'Plugin Development' started by ll_Kidz_ll, Sep 30, 2014.

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

    ll_Kidz_ll

    I need help making straight lines in the direction of the player. But code like .getLineOfSight(null, 10) does not work well because it does not display what I want correctly. I'm using DarkBlades particle pack to display the HEART particle in the location. But: Block b = player.getLineOfSigt(null, 10) displays the hearts everywhere and is to messy for what I want. An example of what I want is the Blood Wizard on mc.hypixel.net TntWizards, how it's casts the straight line of particles. Sorry if its not clear. Any advice?
     
  2. Offline

    97WaterPolo

    ll_Kidz_ll
    Not sure if this would work but...

    for (int x = 0; x < 11; x++){
    ParticleDisplayAt(player.getTargetBlock(null, x).getLocation());
    }

    Not sure what the TnT Wizard class is, but that should summon a line of particles in the direction the player is looking, You could check to see if player.hasLineOfSight() before you run this.
     
  3. Offline

    RingOfStorms

    The block iterator is a fairly primitive solution to drawing lines, and while it is useful in many cases, you can't create detailed lines. Instead what you should do is creator your own LineIterator class that takes in a start location and a direction (in the form of a vector), or a start and end location. Then normalize the direction and divide it my the amount of detail you want your line to have. Then iterate in the direction of the vector from the start location to the end location. Doing it this way will create a much more precise line with closer points rather than the limited 1 block distance that the BlockIterator gives you.
     
  4. @ll_Kidz_ll you can get a vector from the location you want to start the line to the location of the player. then you can calculate a z value for x=1 which you use like: for (x </> xPlayer, x++/--) then you go 1 step on the x and the matching value for z to the player. you do this until your x reaches the value of the xplayer. then you made a straight line. do you unsterstand? i cant explain such complicated calculations very good in english, because it is not my main language
     
  5. Offline

    Skionz

    ll_Kidz_ll Use this
    Code:java
    1. location.add(location.getDirection().multiply(value));

    You can just increment the value.
     
  6. Offline

    ll_Kidz_ll

    Hmm. Well Ill try these methods to use what ever works the best. Thank for all the replies! :D
     
Thread Status:
Not open for further replies.

Share This Page