Last active
February 20, 2021 02:05
-
-
Save misode/137e43fb13f252bcf893b27d5b69406e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// count: CountDecorator | |
// - UniformInt count (min: -10, max: 128, maxSpread: 128) | |
return IntStream.range(0, count.sample(random)) | |
.mapToObj((e) -> pos); | |
// count_noise: CountNoiseDecorator | |
// - double noise_level | |
// - int below_noise | |
// - int above_noise | |
double noise = Biome.BIOME_INFO_NOISE.getValue(posX / 200, posZ / 200, false); | |
int totalCount = noise < noise_level ? below_noise : above_noise; | |
return IntStream.range(0, totalCount) | |
.mapToObj((e) -> pos); | |
// count_noise_biased: NoiseBasedDecorator | |
// - double noise_factor | |
// - double noise_offset | |
// - int noise_to_count_ratio | |
double noise = Biome.BIOME_INFO_NOISE.getValue(posX / noise_factor, posZ / noise_factor, false); | |
int totalCount = Math.ceil((noise + noise_offset) * noise_to_count_ratio); | |
return IntStream.range(0, totalCount) | |
.mapToObj((e) -> pos); | |
// count_extra: CountWithExtraChanceDecorator | |
// - int count | |
// - int extra_count | |
// - float extra_chance | |
int totalCount = count + (random.nextFloat() < extra_chance ? extra_count : 0); | |
return IntStream.range(0, totalCount) | |
.mapToObj((e) -> pos); | |
// range: RangeDecorator | |
// - int bottom_offset | |
// - int top_offset | |
// - int maximum | |
int y = random.nextInt(maximum - top_offset) + bottom_offset; | |
// range_biased: BiasedRangeDecorator | |
int y = random.nextInt(random.nextInt(maximum - top_offset) + bottom_offset); | |
// range_very_biased: VeryBiasedRangeDecorator | |
int y = random.nextInt(random.nextInt(random.nextInt(maximum - top_offset) + bottom_offset) + bottom_offset); | |
return Stream.of(new BlockPos(posX, y, posZ)); | |
// carving_mask: CarvingMaskDecorator | |
// - String step (air|liquid) | |
// - float probability | |
ChunkPos chunkPos = new ChunkPos(pos); | |
BitSet mask = context.getCarvingMask(chunkPos, step); | |
return IntStream.range(0, mask.length()) | |
.filter((i) -> mask.get(i) && random.nextFloat() < probability) | |
.mapToObj((i) -> { | |
int x = chunkPos.getMinBlockX() + i & 15; | |
int y = i >> 8; | |
int z = chunkPos.getMinBlockZ() + i >> 4 & 15; | |
return new BlockPos(x, y, z) | |
}); | |
// heightmap: HeightmapDecorator -> BaseHeightmapDecorator | |
int y = context.getHeight(Heightmap.Types.MOTION_BLOCKING, posX, posZ); | |
return y > 0 ? Stream.of(new BlockPos(posX, y, posZ)) : Stream.of(); | |
// top_solid_heightmap: TopSolidHeightMapDecorator | |
int y = context.getHeight(Heightmap.Types.OCEAN_FLOOR_WG, posX, posZ); | |
return y > 0 ? Stream.of(new BlockPos(posX, y, posZ)) : Stream.of(); | |
// heightmap_world_surface: HeightMapWorldSurfaceDecorator | |
int y = context.getHeight(Heightmap.Types.WORLD_SURFACE_WG, posX, posZ); | |
return y > 0 ? Stream.of(new BlockPos(posX, y, posZ)) : Stream.of(); | |
// heightmap_spread_double: HeightmapDoubleDecorator | |
int y = context.getHeight(Heightmap.Types.MOTION_BLOCKING, posX, posZ); | |
return y > 0 ? Stream.of(new BlockPos(posX, random.nextInt(y * 2), posZ)): Stream.of(); | |
// square: SquareDecorator | |
int x = random.nextInt(16) + posX; | |
int z = random.nextInt(16) + posY; | |
return Stream.of(new BlockPos(x, posY, z)); | |
// depth_average: DepthAverageDecorator | |
// - int baseline | |
// - int spread | |
int y = random.nextInt(spread) + random.nextInt(spread) - spread + baseline; | |
return Stream.of(new BlockPos(posX, y, posZ)); | |
// spread_32_above: Spread32Decorator | |
int y = random.nextInt(posY + 32); | |
return Stream.of(new BlockPos(posX, y, posZ)); | |
// magma: MagmaDecorator | |
int y = context.getSeaLevel() - 5 + random.nextInt(10); | |
return Stream.of(new BlockPos(posX, y, posZ)); | |
// glowstone | |
// - UniformInt count (min: -10, max: 128, maxSpread: 128) | |
int totalCount = random.nextInt(random.nextInt(count.sample(random)) + 1); | |
return IntStream.range(0, totalCount) | |
.mapToObj((e) -> { | |
int x = random.nextInt(16) + posX; | |
int z = random.nextInt(16) + posZ; | |
int y = random.nextInt(120) + 4; | |
return new BlockPos(x, y, z); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment