Structures - McMellonTeam/easierworldcreator GitHub Wiki
List of every structures
##In this section we're gonna be looking at the shapes only. some code here will be used but are explained in other sections (PlaceMoment as well as the try/catch)
Circle
Base
you can generate a circle with a radius of 20 blocks by using the following code :
CircleGen circle = new CircleGen(world, pos, PlaceMoment.OTHER 20);
circle.setBlockLayers(new BlockLayer([...]))
try {
circle.place()
} catch (IOException e) {
throw new RuntimeException(e);
}
this code will place a relatively simple circle :
Changing radius
before placing, you can change the radius :
circle.setRadiusX([...])
and also create an ellipsoid :
circle.setRadiusZ([...])
you can see here an ellipsoid of a radiusx = 10, radiusz = 5 on top of a circle of a radius of 10 on top of the previous circle
Cylinder
Base
as previously show, you can create a cylinder by doing this :
CylinderGen cylinder= new CylinderGen(world, pos, 10,20);
cylinder.setBlockLayers(new BlockLayer([...]))
try {
cylinder.place()
} catch (IOException e) {
throw new RuntimeException(e);
}
this will create a cylinder of a radius of 10 blocks with a height of 20 blocks
Changing values
Like the circle, you can change the radius as well as the height before placing the structure.
Sphere
Base
like previously, to generate a sphere, you can do this
SphereGen sphere= new SphereGen(world, pos, 10);
sphere.setBlockLayers(new BlockLayer([...]))
try {
sphere.place()
} catch (IOException e) {
throw new RuntimeException(e);
}
changing the radius
You can change the three possible radius :
sphere.setRadiusx(10);
sphere.setRadiusz(20);
sphere.setRadiusy(5);
Torus
Base
you can generate a torus Using the following code :
TorusGen torus = new TorusGen(world, pos, 7, 20);
torus.setBlockLayers(new BlockLayer([...]))
try{
torus.place()
} catch (IOException e) {
throw new RuntimeException(e);
}
this will generate a torus like this :
basically, the numbers two numbers that you put you see correspond to this :
Torus Types
torus generation comes with different types. Those types are defined inside the following enum class :
public enum TorusType {
FULL,
VERTICAL_HALF,
HORIZONTAL_HALF,
VERTICAL_CUSTOM,
HORIZONTAL_CUSTOM,
CUSTOM
}
The full torus is the torus that we saw before. Every block will be placed. you have example of the different types :
-
case FULL, saw earlier,
-
case VERTICAL_HALF: to invert the direction, you can set a yRotation of 180° (rotations explained in another file)
-
cave HORIZONTAL_HALF:
Spiral
Base
you can generate a spiral using the following code :
SpiralGen spiralGen = new SpiralGen(world, pos, Shape.PlaceMoment.OTHER,10,30);
spiralGen .setBlockLayers(new BlockLayer([...]))
try {
spiralGen.place();
} catch (IOException e) {
throw new RuntimeException(e);
}
this gives you a fairly simple spiral but you can create way more.
Modifying values:
here you can see what are the values corresponding.
we can change the value of the x and z radius and can create a pair of radius.
A pair of radius allow us to change automatically the radius depending of the height we're at.
For example, we set the radiusx the following pair : new Pair(10,1)
. That means that when the coordinate generation starts, we're at a height of 0, the radius x will be at 10. At the end, the radius will be at 1. This means that when the coordinate generation reached 50% of the height, the radius will be 5 blocks.
In the following case, you can see
SpiralGen spiralGen = new SpiralGen(world, pos, Shape.PlaceMoment.OTHER, 10, 60);
spiralGen.setRadiusx(new Pair<>(10,1));
spiralGen.setRadiusz(new Pair<>(15,1));
spiralGen .setBlockLayers(new BlockLayer([...]))
try {
spiralGen.place();
} catch (IOException e) {
throw new RuntimeException(e);
}
You can see the result here.
You can also set an offset in degrees:
spiralGen.setOffset(90);
The second spiral has an offset of 90°.
Spiral Types
like the torus, there are different types of spirals defined in an enum :
public enum SpiralType {
DEFAULT,
HELICOID,
HALF_HELICOID,
CUSTOM_HELICOOID,
DOUBLE_HELICOID,
HALF_DOUBLE_HELICOID,
CUSTOM_DOUBLE_HELICOID,
LARGE_OUTLINE
}
We used before the DEFAULT
type.
here are the different other types:
- case
HELICOID
: creates an helicoid.
you can also set an angle of the sides with a pair:
spiralGen.setHelicoidAngle(new Pair<>(0,80));
-
case
HALF_HELICOID
: creates a hole in the center of the helicoid large of 50% of the radius. -
case
CUSTOM_HELICOID
: -
case
DOUBLE_HELICOID
: -
case
HALF_DOUBLE_HELICOID
: