Replaced spaces, proper biome getter, imports cleanup

This commit is contained in:
paulevsGitch 2021-12-21 18:06:48 +03:00
parent 91e7bab993
commit 58310d020c
26 changed files with 979 additions and 981 deletions

View file

@ -12,42 +12,42 @@ import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.EndBiome;
public class AmberLandBiome extends EndBiome.Config {
public AmberLandBiome() {
super("amber_land");
}
public AmberLandBiome() {
super("amber_land");
}
@Override
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.fogColor(255, 184, 71)
.fogDensity(2.0F)
.plantsColor(219, 115, 38)
.waterAndFogColor(145, 108, 72)
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_AMBER_LAND)
.particles(EndParticles.AMBER_SPHERE, 0.001F)
.feature(EndFeatures.AMBER_ORE)
.feature(EndFeatures.END_LAKE_RARE)
.feature(EndFeatures.HELIX_TREE)
.feature(EndFeatures.LANCELEAF)
.feature(EndFeatures.GLOW_PILLAR)
.feature(EndFeatures.AMBER_GRASS)
.feature(EndFeatures.AMBER_ROOT)
.feature(EndFeatures.BULB_MOSS)
.feature(EndFeatures.BULB_MOSS_WOOD)
.feature(EndFeatures.CHARNIA_ORANGE)
.feature(EndFeatures.CHARNIA_RED)
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 4)
.spawn(EndEntities.END_SLIME, 30, 1, 2);
}
@Override
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.fogColor(255, 184, 71)
.fogDensity(2.0F)
.plantsColor(219, 115, 38)
.waterAndFogColor(145, 108, 72)
.music(EndSounds.MUSIC_FOREST)
.loop(EndSounds.AMBIENT_AMBER_LAND)
.particles(EndParticles.AMBER_SPHERE, 0.001F)
.feature(EndFeatures.AMBER_ORE)
.feature(EndFeatures.END_LAKE_RARE)
.feature(EndFeatures.HELIX_TREE)
.feature(EndFeatures.LANCELEAF)
.feature(EndFeatures.GLOW_PILLAR)
.feature(EndFeatures.AMBER_GRASS)
.feature(EndFeatures.AMBER_ROOT)
.feature(EndFeatures.BULB_MOSS)
.feature(EndFeatures.BULB_MOSS_WOOD)
.feature(EndFeatures.CHARNIA_ORANGE)
.feature(EndFeatures.CHARNIA_RED)
.structure(VANILLA_FEATURES.getEND_CITY())
.spawn(EntityType.ENDERMAN, 50, 1, 4)
.spawn(EndEntities.END_SLIME, 30, 1, 2);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.AMBER_MOSS.defaultBlockState();
}
};
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.AMBER_MOSS.defaultBlockState();
}
};
}
}

View file

@ -16,61 +16,61 @@ import ru.betterend.world.surface.UmbraSurfaceNoiseCondition;
import java.util.List;
public class UmbraValleyBiome extends EndBiome.Config {
public UmbraValleyBiome() {
super("umbra_valley");
}
public UmbraValleyBiome() {
super("umbra_valley");
}
@Override
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.fogColor(100, 100, 100)
.plantsColor(172, 189, 190)
.waterAndFogColor(69, 104, 134)
.particles(EndParticles.AMBER_SPHERE, 0.0001F)
.loop(EndSounds.UMBRA_VALLEY)
.music(EndSounds.MUSIC_DARK)
.feature(EndFeatures.UMBRALITH_ARCH)
.feature(EndFeatures.THIN_UMBRALITH_ARCH)
.feature(EndFeatures.INFLEXIA)
.feature(EndFeatures.FLAMMALIX);
}
@Override
protected void addCustomBuildData(BCLBiomeBuilder builder) {
builder.fogColor(100, 100, 100)
.plantsColor(172, 189, 190)
.waterAndFogColor(69, 104, 134)
.particles(EndParticles.AMBER_SPHERE, 0.0001F)
.loop(EndSounds.UMBRA_VALLEY)
.music(EndSounds.MUSIC_DARK)
.feature(EndFeatures.UMBRALITH_ARCH)
.feature(EndFeatures.THIN_UMBRALITH_ARCH)
.feature(EndFeatures.INFLEXIA)
.feature(EndFeatures.FLAMMALIX);
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.UMBRALITH.stone.defaultBlockState();
}
@Override
protected SurfaceMaterialProvider surfaceMaterial() {
return new EndBiome.DefaultSurfaceMaterialProvider() {
@Override
public BlockState getTopMaterial() {
return EndBlocks.UMBRALITH.stone.defaultBlockState();
}
@Override
public BlockState getAltTopMaterial() {
return EndBlocks.PALLIDIUM_FULL.defaultBlockState();
}
@Override
public BlockState getAltTopMaterial() {
return EndBlocks.PALLIDIUM_FULL.defaultBlockState();
}
@Override
public boolean generateFloorRule() {
return false;
}
@Override
public boolean generateFloorRule() {
return false;
}
@Override
public SurfaceRuleBuilder surface() {
return super
.surface()
.rule(2,
SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR,
new SwitchRuleSource(
new UmbraSurfaceNoiseCondition(),
List.of(
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
PALLIDIUM_HEAVY,
PALLIDIUM_THIN,
PALLIDIUM_TINY,
SurfaceRules.state(surfaceMaterial().getTopMaterial())
)
)
)
);
}
};
}
@Override
public SurfaceRuleBuilder surface() {
return super
.surface()
.rule(2,
SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR,
new SwitchRuleSource(
new UmbraSurfaceNoiseCondition(),
List.of(
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
PALLIDIUM_HEAVY,
PALLIDIUM_THIN,
PALLIDIUM_TINY,
SurfaceRules.state(surfaceMaterial().getTopMaterial())
)
)
)
);
}
};
}
}

View file

@ -30,7 +30,7 @@ public class BiomeIslandFeature extends DefaultFeature {
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
Biome biome = world.getBiome(pos);
int dist = BlocksHelper.downRay(world, pos, 10) + 1;
int dist = BlocksHelper.downRay(world, pos, 10) + 1;
BlockPos surfacePos = new BlockPos(pos.getX(), pos.getY()-dist, pos.getZ());
BlockState topMaterial = EndBiome.findTopMaterial(world, surfacePos);;

View file

@ -23,55 +23,55 @@ import ru.betterend.noise.OpenSimplexNoise;
import java.util.Random;
public class ThinArchFeature extends DefaultFeature {
private Block block;
public ThinArchFeature(Block block) {
this.block = block;
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext) {
final WorldGenLevel world = featurePlaceContext.level();
BlockPos origin = featurePlaceContext.origin();
Random random = featurePlaceContext.random();
private Block block;
public ThinArchFeature(Block block) {
this.block = block;
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext) {
final WorldGenLevel world = featurePlaceContext.level();
BlockPos origin = featurePlaceContext.origin();
Random random = featurePlaceContext.random();
BlockPos pos = getPosOnSurfaceWG(world, new BlockPos((origin.getX() & 0xFFFFFFF0) | 7, 0, (origin.getZ() & 0xFFFFFFF0) | 7));
if (!world.getBlockState(pos.below(5)).is(TagAPI.BLOCK_GEN_TERRAIN)) {
return false;
}
SDF sdf = null;
float bigRadius = MHelper.randRange(15F, 20F, random);
float variation = bigRadius * 0.3F;
int count = MHelper.randRange(2, 4, random);
for (int i = 0; i < count; i++) {
float smallRadius = MHelper.randRange(0.6F, 1.3F, random);
SDF arch = new SDFTorus().setBigRadius(bigRadius - random.nextFloat() * variation).setSmallRadius(smallRadius).setBlock(block);
float angle = (i - count * 0.5F) * 0.3F + random.nextFloat() * 0.05F + (float) Math.PI * 0.5F;
arch = new SDFRotation().setRotation(Vector3f.XP, angle).setSource(arch);
sdf = sdf == null ? arch : new SDFUnion().setSourceA(sdf).setSourceB(arch);
}
sdf = new SDFRotation().setRotation(MHelper.randomHorizontal(random), random.nextFloat() * MHelper.PI2).setSource(sdf);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
sdf = new SDFCoordModify().setFunction(vec -> {
float dx = (float) noise.eval(vec.y() * 0.02, vec.z() * 0.02);
float dy = (float) noise.eval(vec.x() * 0.02, vec.z() * 0.02);
float dz = (float) noise.eval(vec.x() * 0.02, vec.y() * 0.02);
vec.add(dx * 10, dy * 10, dz * 10);
}).setSource(sdf);
sdf = new SDFDisplacement().setFunction(vec -> {
float offset = vec.y() / bigRadius - 0.5F;
return Mth.clamp(offset * 3, -10F, 0F);
}).setSource(sdf);
float side = (bigRadius + 2.5F) * 2;
if (side > 47) {
side = 47;
}
sdf.fillArea(world, pos, AABB.ofSize(Vec3.atCenterOf(pos), side, side, side));
return true;
}
BlockPos pos = getPosOnSurfaceWG(world, new BlockPos((origin.getX() & 0xFFFFFFF0) | 7, 0, (origin.getZ() & 0xFFFFFFF0) | 7));
if (!world.getBlockState(pos.below(5)).is(TagAPI.BLOCK_GEN_TERRAIN)) {
return false;
}
SDF sdf = null;
float bigRadius = MHelper.randRange(15F, 20F, random);
float variation = bigRadius * 0.3F;
int count = MHelper.randRange(2, 4, random);
for (int i = 0; i < count; i++) {
float smallRadius = MHelper.randRange(0.6F, 1.3F, random);
SDF arch = new SDFTorus().setBigRadius(bigRadius - random.nextFloat() * variation).setSmallRadius(smallRadius).setBlock(block);
float angle = (i - count * 0.5F) * 0.3F + random.nextFloat() * 0.05F + (float) Math.PI * 0.5F;
arch = new SDFRotation().setRotation(Vector3f.XP, angle).setSource(arch);
sdf = sdf == null ? arch : new SDFUnion().setSourceA(sdf).setSourceB(arch);
}
sdf = new SDFRotation().setRotation(MHelper.randomHorizontal(random), random.nextFloat() * MHelper.PI2).setSource(sdf);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
sdf = new SDFCoordModify().setFunction(vec -> {
float dx = (float) noise.eval(vec.y() * 0.02, vec.z() * 0.02);
float dy = (float) noise.eval(vec.x() * 0.02, vec.z() * 0.02);
float dz = (float) noise.eval(vec.x() * 0.02, vec.y() * 0.02);
vec.add(dx * 10, dy * 10, dz * 10);
}).setSource(sdf);
sdf = new SDFDisplacement().setFunction(vec -> {
float offset = vec.y() / bigRadius - 0.5F;
return Mth.clamp(offset * 3, -10F, 0F);
}).setSource(sdf);
float side = (bigRadius + 2.5F) * 2;
if (side > 47) {
side = 47;
}
sdf.fillArea(world, pos, AABB.ofSize(Vec3.atCenterOf(pos), side, side, side));
return true;
}
}

View file

@ -20,54 +20,54 @@ import ru.betterend.world.structures.piece.NBTPiece;
import java.util.Random;
public class EternalPortalStructure extends FeatureBaseStructure {
private static final ResourceLocation STRUCTURE_ID = BetterEnd.makeID("portal/eternal_portal");
private static final StructureTemplate STRUCTURE = StructureHelper.readStructure(STRUCTURE_ID);
private static final ResourceLocation STRUCTURE_ID = BetterEnd.makeID("portal/eternal_portal");
private static final StructureTemplate STRUCTURE = StructureHelper.readStructure(STRUCTURE_ID);
public EternalPortalStructure() {
super(PieceGeneratorSupplier.simple(
EternalPortalStructure::checkLocation,
EternalPortalStructure::generatePieces
));
}
public EternalPortalStructure() {
super(PieceGeneratorSupplier.simple(
EternalPortalStructure::checkLocation,
EternalPortalStructure::generatePieces
));
}
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
if (!BCLStructureFeature.isValidBiome(context)) return false;
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
if (!BCLStructureFeature.isValidBiome(context)) return false;
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
long x = (long) chunkPos.x * (long) chunkPos.x;
long z = (long) chunkPos.z * (long) chunkPos.z;
if (x + z < 1024L) {
return false;
}
if (chunkGenerator.getBaseHeight(
chunkPos.getBlockX(8),
chunkPos.getBlockZ(8),
Heightmap.Types.WORLD_SURFACE_WG,
levelHeightAccessor
) < 5) {
return false;
}
return FeatureBaseStructure.checkLocation(context);
}
long x = (long) chunkPos.x * (long) chunkPos.x;
long z = (long) chunkPos.z * (long) chunkPos.z;
if (x + z < 1024L) {
return false;
}
if (chunkGenerator.getBaseHeight(
chunkPos.getBlockX(8),
chunkPos.getBlockZ(8),
Heightmap.Types.WORLD_SURFACE_WG,
levelHeightAccessor
) < 5) {
return false;
}
return FeatureBaseStructure.checkLocation(context);
}
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
int x = chunkPos.getBlockX(8);
int z = chunkPos.getBlockZ(8);
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
structurePiecesBuilder.addPiece(new NBTPiece(
STRUCTURE_ID,
STRUCTURE,
new BlockPos(x, y - 4, z),
random.nextInt(5),
true,
random
));
}
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
int x = chunkPos.getBlockX(8);
int z = chunkPos.getBlockZ(8);
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
structurePiecesBuilder.addPiece(new NBTPiece(
STRUCTURE_ID,
STRUCTURE,
new BlockPos(x, y - 4, z),
random.nextInt(5),
true,
random
));
}
}

View file

@ -16,33 +16,32 @@ import ru.betterend.world.structures.piece.LakePiece;
import java.util.Random;
public class MegaLakeSmallStructure extends FeatureBaseStructure {
public MegaLakeSmallStructure() {
super(PieceGeneratorSupplier.simple(
FeatureBaseStructure::checkLocation,
MegaLakeSmallStructure::generatePieces
));
}
public MegaLakeSmallStructure() {
super(PieceGeneratorSupplier.simple(
FeatureBaseStructure::checkLocation,
MegaLakeSmallStructure::generatePieces
));
}
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
Biome biome = chunkGenerator.getNoiseBiome(x >> 2, y >> 2, z >> 2);
if (y > 5) {
float radius = MHelper.randRange(20, 40, random);
float depth = MHelper.randRange(5, 10, random);
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
structurePiecesBuilder.addPiece(piece);
}
//TODO: 1.18 right way to get biome?
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
if (y > 5) {
float radius = MHelper.randRange(20, 40, random);
float depth = MHelper.randRange(5, 10, random);
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
structurePiecesBuilder.addPiece(piece);
}
//this.calculateBoundingBox();
}
//this.calculateBoundingBox();
}
}

View file

@ -18,34 +18,33 @@ import java.util.Random;
public class MegaLakeStructure extends FeatureBaseStructure {
public MegaLakeStructure() {
super(PieceGeneratorSupplier.simple(
FeatureBaseStructure::checkLocation,
MegaLakeStructure::generatePieces
));
}
public MegaLakeStructure() {
super(PieceGeneratorSupplier.simple(
FeatureBaseStructure::checkLocation,
MegaLakeStructure::generatePieces
));
}
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
if (y > 5) {
//TODO: 1.18 right way to get biome?
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
if (y > 5) {
Biome biome = chunkGenerator.getNoiseBiome(x >> 2, y >> 2, z >> 2);
float radius = MHelper.randRange(32, 64, random);
float depth = MHelper.randRange(7, 15, random);
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
structurePiecesBuilder.addPiece(piece);
}
float radius = MHelper.randRange(32, 64, random);
float depth = MHelper.randRange(7, 15, random);
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
structurePiecesBuilder.addPiece(piece);
}
//this.calculateBoundingBox();
}
//this.calculateBoundingBox();
}
}

View file

@ -17,39 +17,39 @@ import java.util.Random;
public class MountainStructure extends FeatureBaseStructure {
public MountainStructure() {
super(PieceGeneratorSupplier.simple(
FeatureBaseStructure::checkLocation,
MountainStructure::generatePieces
));
}
public MountainStructure() {
super(PieceGeneratorSupplier.simple(
FeatureBaseStructure::checkLocation,
MountainStructure::generatePieces
));
}
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
final Random random = context.random();
final ChunkPos chunkPos = context.chunkPos();
final ChunkGenerator chunkGenerator = context.chunkGenerator();
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
if (y > 5) {
//TODO: 1.18 right way to get biome?
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
if (y > 5) {
//TODO: 1.18 right way to get biome?
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
float radius = MHelper.randRange(50, 100, random);
float height = radius * MHelper.randRange(0.8F, 1.2F, random);
CrystalMountainPiece piece = new CrystalMountainPiece(
new BlockPos(x, y, z),
radius,
height,
random,
biome
);
structurePiecesBuilder.addPiece(piece);
}
float radius = MHelper.randRange(50, 100, random);
float height = radius * MHelper.randRange(0.8F, 1.2F, random);
CrystalMountainPiece piece = new CrystalMountainPiece(
new BlockPos(x, y, z),
radius,
height,
random,
biome
);
structurePiecesBuilder.addPiece(piece);
}
//this.calculateBoundingBox();
}
//this.calculateBoundingBox();
}
}

View file

@ -38,7 +38,7 @@ public class CavePiece extends BasePiece {
}
@Override
@Override
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
int x1 = MHelper.max(this.boundingBox.minX(), blockBox.minX());
int z1 = MHelper.max(this.boundingBox.minZ(), blockBox.minZ());

View file

@ -9,20 +9,20 @@ import ru.betterend.noise.OpenSimplexNoise;
* Noise source that returns a value in [0, 3]
*/
public class SulphuricSurfaceNoiseCondition implements NumericProvider {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(5123);
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(5123);
@Override
public int getNumber(SurfaceRulesContextAccessor context) {
final int x = context.getBlockX();
final int z = context.getBlockZ();
final double value = NOISE.eval(x * 0.03, z * 0.03) + NOISE.eval(x * 0.1, z * 0.1) * 0.3 + MHelper.randRange(
-0.1,
0.1,
MHelper.RANDOM
);
if (value < -0.6) return 0;
if (value < -0.3) return 1;
if (value < -0.5) return 2;
return 3;
}
@Override
public int getNumber(SurfaceRulesContextAccessor context) {
final int x = context.getBlockX();
final int z = context.getBlockZ();
final double value = NOISE.eval(x * 0.03, z * 0.03) + NOISE.eval(x * 0.1, z * 0.1) * 0.3 + MHelper.randRange(
-0.1,
0.1,
MHelper.RANDOM
);
if (value < -0.6) return 0;
if (value < -0.3) return 1;
if (value < -0.5) return 2;
return 3;
}
}

View file

@ -9,21 +9,21 @@ import ru.betterend.noise.OpenSimplexNoise;
* Noise source that returns a value in [0, 4]
*/
public class UmbraSurfaceNoiseCondition implements NumericProvider {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(1512);
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(1512);
@Override
public int getNumber(SurfaceRulesContextAccessor context) {
final int x = context.getBlockX();
final int z = context.getBlockZ();
final double value = NOISE.eval(x * 0.03, z * 0.03) + NOISE.eval(x * 0.1, z * 0.1) * 0.3 + MHelper.randRange(
-0.1,
0.1,
MHelper.RANDOM
);
if (value > 0.4) return 0;
if (value > 0.15) return 1;
if (value > -0.15) return 2;
if (value > -0.4) return 3;
return 4;
}
@Override
public int getNumber(SurfaceRulesContextAccessor context) {
final int x = context.getBlockX();
final int z = context.getBlockZ();
final double value = NOISE.eval(x * 0.03, z * 0.03) + NOISE.eval(x * 0.1, z * 0.1) * 0.3 + MHelper.randRange(
-0.1,
0.1,
MHelper.RANDOM
);
if (value > 0.4) return 0;
if (value > 0.15) return 1;
if (value > -0.15) return 2;
if (value > -0.4) return 3;
return 4;
}
}