29 lines
1.3 KiB
Java
29 lines
1.3 KiB
Java
package net.minecraft.world.level.levelgen.placement;
|
|
|
|
import net.minecraft.world.level.levelgen.feature.configurations.DecoratorConfiguration;
|
|
import java.util.stream.IntStream;
|
|
import java.util.stream.Stream;
|
|
import net.minecraft.core.BlockPos;
|
|
import java.util.Random;
|
|
import com.mojang.datafixers.Dynamic;
|
|
import java.util.function.Function;
|
|
import net.minecraft.world.level.levelgen.feature.configurations.CountRangeDecoratorConfiguration;
|
|
|
|
public class CountVeryBiasedRangeDecorator extends SimpleFeatureDecorator<CountRangeDecoratorConfiguration> {
|
|
public CountVeryBiasedRangeDecorator(final Function<Dynamic<?>, ? extends CountRangeDecoratorConfiguration> function) {
|
|
super(function);
|
|
}
|
|
|
|
public Stream<BlockPos> place(final Random random, final CountRangeDecoratorConfiguration cgf, final BlockPos fk) {
|
|
final int integer5;
|
|
final int integer6;
|
|
final int integer7;
|
|
return IntStream.range(0, cgf.count).<BlockPos>mapToObj(integer -> {
|
|
integer5 = random.nextInt(16) + fk.getX();
|
|
integer6 = random.nextInt(16) + fk.getZ();
|
|
integer7 = random.nextInt(random.nextInt(random.nextInt(cgf.maximum - cgf.topOffset) + cgf.bottomOffset) + cgf.bottomOffset);
|
|
return new BlockPos(integer5, integer7, integer6);
|
|
});
|
|
}
|
|
}
|