LayerType - McMellonTeam/easierworldcreator GitHub Wiki
Base
To assign a BlockState
to each coordinates, we need 3 things:
- a list of
BlockLayers
; - a
LayerType
; - a
PlaceType
;
We're going to focus on LayerType
for this page. The 2 others can be found on the wiki.
The layerPlace
enums allow you to choose wich BlockLayer
will be choosen from the list of the BlockLayer
. By default, the BlockLayer
that will be used id the SURFACE
one. You have the choice between 6 different types.
To change a BlockType
, you can use the following method:
shape.setLayersType(Shape.LayersType./*the type you want*/);
SURFACE
the SURFACE
BlockType
is, as mention earlier, the default one. It can be used to give a natural aspect to your shape. It will choose the BlockLayer
depending on the blocks on top of him.
You can see here:
To place the half sphere, I uses the following code:
SphereGen sphere = new SphereGen(world, pos, Shape.PlaceMoment.OTHER, 14);
sphere.setLayersType(Shape.LayersType.SURFACE);
BlockLayer layer1 = new BlockLayer(Blocks.GRASS_BLOCK.getDefaultState(), 1);
BlockLayer layer2 = new BlockLayer(Blocks.DIRT.getDefaultState(), 1);
BlockLayer layer3 = new BlockLayer(List.of(Blocks.STONE.getDefaultState(), Blocks.COBBLESTONE.getDefaultState()), 5);
BlockLayer layer4 = new BlockLayer(Blocks.DEEPSLATE.getDefaultState(), 2);
sphere.setBlockLayers(List.of(layer1, layer2, layer3, layer4));
sphere.setHalfSphere(SphereGen.SphereType.HALF);
sphere.setHalfSphereDirection(Direction.NORTH);
try {
sphere.place();
} catch (IOException e) {
e.printStackTrace();
}
You can see that:
- the first
BlockLayer
(the grass) is put on top of the sphere with a depth of 1: - the second
BlockLayer
(the dirt) is put right under the grass with a depth of 1; - the third
BlockLayer
(the stone/ cobblestone) is put under the firt with a depth of 5; - the last
BlockLayer
(the deepslate) is put under the stone/cobblestone until the end of the shape;
the first BlockLayer
will be placed on all of the structure.
the second one will replace each blocks that has the first BlockLayer
on top of them.
Then the process is being repeated util the last BlockLayer
.
The blocks are placed after the end of the algorithm for performance gains (or later if PlaceMoment == PlaceMoment.WORLD_GEN
).
INNER_RADIAL
The INNER_RADIAL
LayerType
will place the BlockLayer
depending on the distance on the center point.
OUTER_RADIAL
The OUTER_RADIAL
LayerType
will place the BlockLayer
depending on the distance on the center point but with the opposite order of INNER_RADIAL
.
INNER_CYLINDRICAL
as you can see above, the center is a point. The INNER_CYLINDRICAL
and the OUTER_CYLINDRICAL
change the center point to an axis.
OUTER_CYLINDRICAL
like the OUTER_RADIAL
, the OUTER_CYLINDRICAL
invert the BlockLayer
to choose from.
ALONG_DIRECTION
the Blocks will be placed on a plan orthogonal to an axis that you have determined before.
to change the axis direction, use
shape.setLayerDirection(new Vec3d(/*coordinates*/));
The normal direction being
new Vec3d(0,1,0);
here is 2 cylinder placed with this LayerType
.
One having all of it's blockLayer beign 2 block depth, the other one having all of it's BlockLayers being 1 block depth. And having this direction:
new Vec3d(1,1,0);