Started by Litleck
on Sat, 06/30/2018 - 04:20
Topic category: Advanced modding
Hello,
So I have created this function which randomly places a block in a specified range.
This gets blocks randomly placed in a cube of 4 blocks away from the center point. How would I be able to modify this so that it'll form a sphere? I would need to use sin, cos and maybe some tan?
All help will be appreciated.
This is out of my possibilities. I can suggest you something, but it is VEERY long. And I don't know if I got you right.
So, for range 1 sphere(1 block on every side) use something like "place block x+1, x-1, y+1, y-1, z+1, z-1" and if you want to more just loop it but except 1 you place another variable that is increasing every loop. But if you mean placing blocks in sphere range rather than cuboid, sorry. This is out of my possibilities.
The easiest way is iterating a cube (centered to the center of the sphere) that has the length of a side two times bigger than the radius of the sphere, and checking for each block in the cube if its distance from the center is less or equal to the radius.
Wouldn't it just be easier to create a schematic of a sphere thing & then just use the "Place schematic" button?
You can use the loop blocks in MCreator to achieve this the way Nuparu suggested.