Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Define an area

Comments in 'Plugin Development' started by Tuff, Jun 22, 2014.

  1. Tuff
    Offline

    Tuff Active Member

    Joined:
    Jan 25, 2014
    Posts:
    203
    Minecraft User:
    Roboroug2
    Hey guys! I am working on a plugin, and am stuck on something that seems simple, but I can't seem to figure out. How can I define a three dimensional area? I have a concept in my head, but I cant figure out how to do it.

    I want to make a plugin that does something when a player walks into a certain area. I am planning on using the EntityMoveEvent to figure out if the player is in the area, I just dont know how to define the area. The creator would be able to do /pos1 and /pos2 and /create [name] to create the area. I have never used the Vector3 stuff before and I dont know how it works, it you could help me out that would be great!
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I personally prefer just doing /create <Name> and the being prompted to tap a position one and two. More accurate as there is no rounding and less commands.
  3. Tuff
    Offline

    Tuff Active Member

    Joined:
    Jan 25, 2014
    Posts:
    203
    Minecraft User:
    Roboroug2
    That's pretty cool too, It doesn't really matter to me how the two points are defined, I just have no clue how to define the area inside the points.

    Would I have to make it make a list of every coordinate inside the area? And then match the EntityMove event to the coordinates to see if they match? That was my original idea, but I thought that there had to be an easier, more efficient way.
  4. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You check if x is between min(x1,x2) and max(x1,x2) and the same for y and z. If you want to go through every point in the area you do three for loops inside each other (x, y, z).
    Tuff likes this.
  5. Tuff
    Offline

    Tuff Active Member

    Joined:
    Jan 25, 2014
    Posts:
    203
    Minecraft User:
    Roboroug2
    OOOOOOHHHH!

    So would that be an IF statement? like IF the player is inside x, then go on to the next IF, which would be IF player is inside y and so on? I get what you are saying, so it does not really matter if it is an IF statement or not.

    Thanks genius!
    iJoshuaHD likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    iJoshuaHD and Tuff like this.
  7. Tuff
    Offline

    Tuff Active Member

    Joined:
    Jan 25, 2014
    Posts:
    203
    Minecraft User:
    Roboroug2
  8. Tuff
    Offline

    Tuff Active Member

    Joined:
    Jan 25, 2014
    Posts:
    203
    Minecraft User:
    Roboroug2
    Sorry, that his some useful stuff you have there, thanks for sharing itm
    PEMapModder likes this.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Like pls xD
    iJoshuaHD and Tuff like this.

Share This Page

Advertisement