determining the dimensions of a world?

Discussion in 'Plugin Development' started by qwrrty, Feb 28, 2011.

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

    qwrrty

    I'm toying around with a plugin idea that my co-admin came up with, which involves building features at a randomly chosen location in the world. Is there a way to get the dimensions of a given world so that I can choose a block by generating random X/Y/Z coordinates?

    If I understand correctly, world chunks are generated on-demand, so the world is not even guaranteed to have a rectangular shape. That's okay. If I had even a way of getting the minimum and maximum X and Z coordinates for existing chunks (i.e. the dimensions of the smallest enclosing rectangle), that would be a good start. I don't mind creating a new chunk if I have to.

    If that's not possible, I could also choose a chunk at random and then choose a random block within that chunk. I can't figure out how to do that either; there's org.bukkit.World.getLoadedChunks(), but I think that only returns chunks that are currently active, not chunks that exist but presently don't have player activity.
     
Thread Status:
Not open for further replies.

Share This Page