use of net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings in project Tropicraft by Tropicraft.
the class SingleNoAirJigsawPiece method getSettings.
@Override
protected StructurePlaceSettings getSettings(Rotation rotation, BoundingBox box, boolean b) {
StructurePlaceSettings settings = super.getSettings(rotation, box, b);
settings.popProcessor(BlockIgnoreProcessor.STRUCTURE_BLOCK);
settings.addProcessor(BlockIgnoreProcessor.STRUCTURE_AND_AIR);
return settings;
}
use of net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings in project Tropicraft by Tropicraft.
the class PathStructureProcessor method getPathDirection.
@Nullable
protected Direction.Axis getPathDirection(LevelReader level, BlockPos seedPos, StructureTemplate.StructureBlockInfo current, StructurePlaceSettings settings, StructureTemplate template) {
/*
* Use special marker jigsaw blocks to represent "vectors" of paths.
*
* Each jigsaw with attachment type "tropicraft:path_center" is a different vector,
* with the facing representing the direction of the vector. A vector extends from
* the jigsaw block to the end of the structure in that direction, and 1 block to
* either side.
*/
final StructurePlaceSettings infiniteBounds = settings.copy();
infiniteBounds.setBoundingBox(BoundingBox.infinite());
return VECTOR_CACHE.computeIfAbsent(settings, s -> // Find all jigsaw blocks
template.filterBlocks(seedPos, infiniteBounds, Blocks.JIGSAW, true).stream().filter(// Filter for vector markers
b -> b.nbt.getString("target").equals(Constants.MODID + ":path_center")).map(// Convert pos to structure local, extract facing
bi -> new PathVector(level.getHeightmapPos(Heightmap.Types.WORLD_SURFACE_WG, bi.pos).subtract(seedPos), JigsawBlock.getFrontFacing(bi.state))).collect(Collectors.toList())).stream().filter(// Find vectors that contain this block
pv -> pv.contains(current.pos.subtract(seedPos), settings)).findFirst().map(pv -> pv.dir.getAxis()).orElse(null);
}
Aggregations