Search in sources :

Example 21 with NoiseColumn

use of net.minecraft.world.level.NoiseColumn in project Brass_Amber_BattleTowers by BrassAmber-Mods.

the class LandBattleTower method isFeatureChunk.

public static boolean isFeatureChunk(PieceGeneratorSupplier.Context<BTJigsawConfiguration> context) {
    BlockPos centerOfChunk = context.chunkPos().getMiddleBlockPosition(0);
    context.chunkGenerator();
    // Grab height of land. Will stop at first non-air block. --TelepathicGrunt
    int landHeight = context.chunkGenerator().getFirstOccupiedHeight(centerOfChunk.getX(), centerOfChunk.getZ(), Heightmap.Types.WORLD_SURFACE_WG, context.heightAccessor());
    // Grabs column of blocks at given position. In overworld, this column will be made of stone, water, and air.
    // In nether, it will be netherrack, lava, and air. End will only be endstone and air. It depends on what block
    // the chunk generator will place for that dimension. --TelepathicGrunt
    NoiseColumn columnOfBlocks = context.chunkGenerator().getBaseColumn(centerOfChunk.getX(), centerOfChunk.getZ(), context.heightAccessor());
    // Combine the column of blocks with land height and you get the top block itself which you can test. --TelepathicGrunt
    BlockState topBlock = columnOfBlocks.getBlock(landHeight);
    // ;
    return isFlatLand(context.chunkGenerator(), centerOfChunk, context.heightAccessor()) && landHeight <= 210;
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) NoiseColumn(net.minecraft.world.level.NoiseColumn) BlockPos(net.minecraft.core.BlockPos)

Aggregations

NoiseColumn (net.minecraft.world.level.NoiseColumn)21 BlockPos (net.minecraft.core.BlockPos)19 BlockState (net.minecraft.world.level.block.state.BlockState)18 ChunkPos (net.minecraft.world.level.ChunkPos)4 LegacyRandomSource (net.minecraft.world.level.levelgen.LegacyRandomSource)3 WorldgenRandom (net.minecraft.world.level.levelgen.WorldgenRandom)3 StructureSet (net.minecraft.world.level.levelgen.structure.StructureSet)3 ArrayList (java.util.ArrayList)2 PoolElementStructurePiece (net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece)2 Direction (net.minecraft.core.Direction)1 LevelHeightAccessor (net.minecraft.world.level.LevelHeightAccessor)1 Biome (net.minecraft.world.level.biome.Biome)1 CheckerboardColumnBiomeSource (net.minecraft.world.level.biome.CheckerboardColumnBiomeSource)1 PieceGenerator (net.minecraft.world.level.levelgen.structure.pieces.PieceGenerator)1 NotNull (org.jetbrains.annotations.NotNull)1