0

So I have asked on spigotmc, a minecraft forum and didn't receive much information from it. Basically, I am wanting to create a skyblock code where in essence it spawns a block every 100 blocks away, so it looks something like this:

|X|X|X|X|X|X|X|X|X|X|
|X|O|X|O|X|O|X|O|X|O|
|X|X|X|X|X|X|X|X|X|X|
|X|O|X|O|X|O|X|O|X|O|
|X|X|X|X|X|X|X|X|X|X|
|X|O|X|O|X|O|X|O|X|O|
|X|X|X|X|X|X|X|X|X|X|

O being an island, X being blank space/air

Having the ability to add another 'island' from where the spiral is essential so it doesn't create one where someone else's is already. I would assume this would be saved as co-ordinates.

2 Answers2

0

You could always use the modulus operator. That, something like:

BlockPos pos = ... //whatever the position is
if (pos.getX() % 100 == 0 && pos.getY() % 100 == 0 && pos.getZ() % 100 == 0){
   // create a block
}

The modulus operator, %, is the remainder when you divide.

Leo Izen
  • 4,165
  • 7
  • 37
  • 56
  • Yes, but I don't just want a straight line of them. –  Jul 04 '16 at 07:14
  • Then why'd you ask how to create a straight line of them and draw ascii art of how to create a straight line of them...? – Leo Izen Jul 04 '16 at 07:25
  • 2
    I didn't, I know the drawing thing is awful and I clearly said "spiral" in the subject and throughout. –  Jul 04 '16 at 07:41
  • if by "throughout" you mean in one location in the last paragraph then yes, you said it "throughout". I saw a picture that suggested a square grid and the phrase "every 100 blocks" – Leo Izen Jul 04 '16 at 08:34
0

You can construct a simple spiral path out of "L" shapes.

Choose a center point, the size of the gap between the lines, and how big the final spiral is to be.

Start in the center.
Set L := size of gap + 1
Set N := L
While N < final size
    Go forward N steps dropping blocks as you go
    Turn left 90 degrees
    Go forward N steps dropping blocks as you go
    Turn left 90 degrees
    Increase N by L

Creating a round spiral is harder: Algorithm to solve the points of a evenly-distributed / even-gaps spiral?

Community
  • 1
  • 1
Simon G.
  • 6,587
  • 25
  • 30