minecraft-source/src/net/minecraft/world/level/levelgen/placement/LakeLavaPlacementDecorator....

31 lines
1.4 KiB
Java
Raw Normal View History

2020-07-22 06:23:34 +01:00
package net.minecraft.world.level.levelgen.placement;
2020-07-22 06:25:47 +01:00
import net.minecraft.world.level.levelgen.feature.configurations.DecoratorConfiguration;
2020-07-22 06:23:34 +01:00
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import java.util.Random;
import net.minecraft.world.level.levelgen.ChunkGeneratorSettings;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.LevelAccessor;
import com.mojang.datafixers.Dynamic;
import java.util.function.Function;
2020-07-22 06:25:47 +01:00
public class LakeLavaPlacementDecorator extends FeatureDecorator<ChanceDecoratorConfiguration> {
public LakeLavaPlacementDecorator(final Function<Dynamic<?>, ? extends ChanceDecoratorConfiguration> function) {
2020-07-22 06:23:34 +01:00
super(function);
}
@Override
2020-07-22 06:25:47 +01:00
public Stream<BlockPos> getPositions(final LevelAccessor bju, final ChunkGenerator<? extends ChunkGeneratorSettings> bzx, final Random random, final ChanceDecoratorConfiguration cja, final BlockPos fk) {
if (random.nextInt(cja.chance / 10) == 0) {
final int integer7 = random.nextInt(16) + fk.getX();
final int integer8 = random.nextInt(16) + fk.getZ();
final int integer9 = random.nextInt(random.nextInt(bzx.getGenDepth() - 8) + 8);
if (integer9 < bju.getSeaLevel() || random.nextInt(cja.chance / 8) == 0) {
return Stream.<BlockPos>of(new BlockPos(integer7, integer9, integer8));
2020-07-22 06:23:34 +01:00
}
}
return Stream.<BlockPos>empty();
}
}