Skip to content

Commit

Permalink
clean up column feature code
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJumper committed Jan 31, 2024
1 parent 9506bb3 commit 684386e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> pContext) {
RandomSource random = pContext.random();

int columnHeight = 0;
BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos(origin.getX(), origin.getY() + 1, origin.getZ());
while(level.getBlockState(blockPos.below()).isAir()) {
BlockPos.MutableBlockPos blockPos = origin.mutable();
while(level.getBlockState(blockPos).isAir()) {
columnHeight++;
blockPos.move(0, 1, 0);
}
Expand All @@ -41,7 +41,7 @@ public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> pContext) {
int gapStart = (amberLength - gapSize) / 2;
int gapPlacement = 0;

blockPos.set(origin.getX(), origin.getY(), origin.getZ());
blockPos = origin.mutable();
for(int i = 1; i < columnHeight + 1; i++) {
float percentageToTop = i / ((float) columnHeight + 1);

Expand Down Expand Up @@ -101,7 +101,7 @@ private void columnBase(WorldGenLevel level, RandomSource random, BlockPos origi
private void placeSection(WorldGenLevel level, RandomSource random, BlockPos pos, double baseHeight, int iteration, int loop, double multiplier, boolean bottom) {
float p = random.nextFloat();
for(int j = 0; j < baseHeight; j++) {
BlockPos location = spread(bottom ? pos.above(j) : pos.below(j), iteration, loop); // no
BlockPos location = spread(bottom ? pos.above(j) : pos.below(j), iteration, loop);

if(iteration > 3 && multiplier > 1) return;
if(j == baseHeight - 2 && j != 0 && p < 0.1f) level.setBlock(location, DDBlocks.GLOOMY_SCULK.get().defaultBlockState(), 3);
Expand Down Expand Up @@ -131,14 +131,14 @@ private void stretchToFloor(WorldGenLevel level, BlockPos pos, int i, int loop,
BlockPos blockPos = spread(bottom ? pos.below() : pos.above(), i, loop);

if(bottom) {
while(!level.getBlockState(blockPos).is(DDBlocks.GLOOMSLATE.get()) && !level.getBlockState(blockPos).is(Blocks.DEEPSLATE) && !level.isOutsideBuildHeight(blockPos)) {
while(!level.getBlockState(blockPos).is(DDBlocks.SCULK_STONE.get()) && !level.getBlockState(blockPos).is(DDBlocks.GLOOMSLATE.get()) && !level.getBlockState(blockPos).is(Blocks.DEEPSLATE) && !level.isOutsideBuildHeight(blockPos)) {
level.setBlock(blockPos, DDBlocks.GLOOMSLATE.get().defaultBlockState(), 3);
blockPos = blockPos.below();
}
return;
}

while(!level.getBlockState(blockPos).is(DDBlocks.GLOOMY_SCULK.get()) && !level.getBlockState(blockPos).is(DDBlocks.GLOOMSLATE.get()) && !level.getBlockState(blockPos).is(Blocks.DEEPSLATE) && !level.isOutsideBuildHeight(blockPos)) {
while(!level.getBlockState(blockPos).is(DDBlocks.SCULK_STONE.get()) && !level.getBlockState(blockPos).is(DDBlocks.GLOOMY_SCULK.get()) && !level.getBlockState(blockPos).is(DDBlocks.GLOOMSLATE.get()) && !level.getBlockState(blockPos).is(Blocks.DEEPSLATE) && !level.isOutsideBuildHeight(blockPos)) {
level.setBlock(blockPos, DDBlocks.GLOOMSLATE.get().defaultBlockState(), 3);
blockPos = blockPos.above();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> pContext) {
RandomSource random = pContext.random();

int columnHeight = 0;
BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos(origin.getX(), origin.getY() + 1, origin.getZ());
while(level.getBlockState(blockPos.below()).isAir()) {
BlockPos.MutableBlockPos blockPos = origin.mutable();
while(level.getBlockState(blockPos).isAir()) {
columnHeight++;
blockPos.move(0, 1, 0);
}
Expand All @@ -33,7 +33,7 @@ public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> pContext) {
level.setBlock(origin.below(), DDBlocks.SCULK_STONE.get().defaultBlockState(), 3);
level.setBlock(origin.above(columnHeight), DDBlocks.SCULK_STONE.get().defaultBlockState(), 3);

blockPos.set(origin.getX(), origin.getY(), origin.getZ());
blockPos = origin.mutable();
for(int i = 1; i < columnHeight + 1; i++) {
level.setBlock(blockPos, DDBlocks.SCULK_STONE.get().defaultBlockState(), 3);
blockPos.move(0, 1, 0);
Expand Down

0 comments on commit 684386e

Please sign in to comment.