Search in sources :

Example 1 with LargeDripstoneConfiguration

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;
        }
    }
}
Also used : LargeDripstoneConfiguration(net.minecraft.world.level.levelgen.feature.configurations.LargeDripstoneConfiguration) Random(java.util.Random) Column(net.minecraft.world.level.levelgen.Column) BlockPos(net.minecraft.core.BlockPos) DripstoneUtils(net.minecraft.world.level.levelgen.feature.DripstoneUtils) WorldGenLevel(net.minecraft.world.level.WorldGenLevel)

Aggregations

Random (java.util.Random)1 BlockPos (net.minecraft.core.BlockPos)1 WorldGenLevel (net.minecraft.world.level.WorldGenLevel)1 Column (net.minecraft.world.level.levelgen.Column)1 DripstoneUtils (net.minecraft.world.level.levelgen.feature.DripstoneUtils)1 LargeDripstoneConfiguration (net.minecraft.world.level.levelgen.feature.configurations.LargeDripstoneConfiguration)1