Get Chunk Corners

Discussion in 'Plugin Development' started by LordVakar, Jul 9, 2014.

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

    LordVakar

    This may be a silly question, but how do you get two chunk corners from a location to make a cuboid?
     
  2. Offline

    Hadenir

    NotEnoughItems Mod has got function, that allows to see corners of chunks.
     
  3. Offline

    Beeperdp

    WorldEdit lets you do //chunk to select a chunk, alternatively, if your coordinates x or y are divisible by 16 then you are on a chunk border. You could use the f3 coordinate menu to find the borders then.
     
  4. Offline

    dsouzamatt

    LordVakar You could probably do something involving modulus.

    For example, if the remainder of your location's x co-ordinate divided by 16 is 3, you would subtract 3 from that coordinate to give you the x line of one side of the chunk. To get the other, simply add 16 to that.
     
  5. Offline

    LordVakar

    Hadenir
    No.
    Beeperdp
    I don't want to use an external plugin but rather code this in, but thanks.
    dsouzamatt
    I don't see the math behind that by using remainders hm but it may work
    I'll test it with 0,0.
     
  6. Perhaps fireblast709 could help, I remember him posting something related to this.
     
  7. Offline

    fireblast709

    LordVakar 0,0,0 and 15,255,15 (world height - 1, so it could be different. World has a method for this), relative to the chunk origin.

    Chunk x is Math.floor(x/16), Chunk z is Math.floor(z/16). Alternatively use the chunk x and z, and multiply with 16.

    Then add the relative coords from the begin to those coords and you will have the corners.
     
  8. Offline

    Hadenir

    LordVakar Chunk is a region 16x16 and 256 blocks high. Do if you have got x and z you can devide you coords by 16.
    For example: Corners of chunk are on x:16 z:32 and x:32 z:48
     
Thread Status:
Not open for further replies.

Share This Page