Biome Features Updated

This commit is contained in:
Frank Bauer 2021-06-24 17:58:09 +02:00
parent aca43764ad
commit 78bf62bdca
8 changed files with 57 additions and 19 deletions

View file

@ -1,13 +1,10 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.FluidState;
@ -20,6 +17,8 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import java.util.Random;
public class EndLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
@ -28,7 +27,7 @@ public class EndLakeFeature extends DefaultFeature {
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
final Random random = featureConfig.random();
final BlockPos blockPos = featureConfig.origin();
BlockPos blockPos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
double radius = MHelper.randRange(10.0, 20.0, random);
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);

View file

@ -113,7 +113,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
floorPositions.forEach((pos) -> {
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
Feature<?> feature = biome.getFloorFeature();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
}
@ -129,7 +129,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
Feature<?> feature = biome.getCeilFeature();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
}

View file

@ -94,7 +94,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
Feature<?> feature = biome.getFloorFeature();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
}
@ -110,7 +110,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
Feature<?> feature = biome.getCeilFeature();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
}

View file

@ -189,7 +189,7 @@ public class TunelCaveFeature extends EndCaveFeature {
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
Feature<?> feature = biome.getFloorFeature();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
}
@ -206,7 +206,7 @@ public class TunelCaveFeature extends EndCaveFeature {
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
Feature<?> feature = biome.getCeilFeature();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
}