use of net.minecraft.world.level.levelgen.feature.configurations.LargeDripstoneConfiguration in project FrostRealm by baguchan.
the class LargeIceFeature method place.
public boolean place(FeaturePlaceContext<LargeDripstoneConfiguration> p_159967_) {
WorldGenLevel worldgenlevel = p_159967_.level();
BlockPos blockpos = p_159967_.origin();
LargeDripstoneConfiguration largedripstoneconfiguration = p_159967_.config();
Random random = p_159967_.random();
if (!isEmptyOrWater(worldgenlevel, blockpos)) {
return false;
} else {
Optional<Column> optional = Column.scan(worldgenlevel, blockpos, largedripstoneconfiguration.floorToCeilingSearchRange, DripstoneUtils::isEmptyOrWater, LargeIceFeature::isIceBase);
if (optional.isPresent() && optional.get() instanceof Column.Range) {
Column.Range column$range = (Column.Range) optional.get();
if (column$range.height() < 4) {
return false;
} else {
int i = (int) ((float) column$range.height() * largedripstoneconfiguration.maxColumnRadiusToCaveHeightRatio);
int j = Mth.clamp(i, largedripstoneconfiguration.columnRadius.getMinValue(), largedripstoneconfiguration.columnRadius.getMaxValue());
int k = Mth.randomBetweenInclusive(random, largedripstoneconfiguration.columnRadius.getMinValue(), j);
LargeIceFeature.LargeDripstone LargeIceFeature$largedripstone = makeDripstone(blockpos.atY(column$range.ceiling() - 1), false, random, k, largedripstoneconfiguration.stalactiteBluntness, largedripstoneconfiguration.heightScale);
LargeIceFeature.LargeDripstone LargeIceFeature$largedripstone1 = makeDripstone(blockpos.atY(column$range.floor() + 1), true, random, k, largedripstoneconfiguration.stalagmiteBluntness, largedripstoneconfiguration.heightScale);
LargeIceFeature.WindOffsetter LargeIceFeature$windoffsetter;
if (LargeIceFeature$largedripstone.isSuitableForWind(largedripstoneconfiguration) && LargeIceFeature$largedripstone1.isSuitableForWind(largedripstoneconfiguration)) {
LargeIceFeature$windoffsetter = new LargeIceFeature.WindOffsetter(blockpos.getY(), random, largedripstoneconfiguration.windSpeed);
} else {
LargeIceFeature$windoffsetter = LargeIceFeature.WindOffsetter.noWind();
}
boolean flag = LargeIceFeature$largedripstone.moveBackUntilBaseIsInsideStoneAndShrinkRadiusIfNecessary(worldgenlevel, LargeIceFeature$windoffsetter);
boolean flag1 = LargeIceFeature$largedripstone1.moveBackUntilBaseIsInsideStoneAndShrinkRadiusIfNecessary(worldgenlevel, LargeIceFeature$windoffsetter);
if (flag) {
LargeIceFeature$largedripstone.placeBlocks(worldgenlevel, random, LargeIceFeature$windoffsetter);
}
if (flag1) {
LargeIceFeature$largedripstone1.placeBlocks(worldgenlevel, random, LargeIceFeature$windoffsetter);
}
return true;
}
} else {
return false;
}
}
}
Aggregations