Fixed surface gen in UmbraValleyBiome
This commit is contained in:
parent
338aee76e9
commit
5c12813b3e
5 changed files with 79 additions and 22 deletions
|
@ -26,6 +26,11 @@ public class EndBiome extends BCLBiome {
|
|||
protected static final SurfaceRules.RuleSource FLAVOLITE =SurfaceRules.state(EndBlocks.FLAVOLITE.stone.defaultBlockState());
|
||||
protected static final SurfaceRules.RuleSource SULPHURIC_ROCK =SurfaceRules.state(EndBlocks.SULPHURIC_ROCK.stone.defaultBlockState());
|
||||
protected static final SurfaceRules.RuleSource BRIMSTONE =SurfaceRules.state(EndBlocks.BRIMSTONE.defaultBlockState());
|
||||
protected static final SurfaceRules.RuleSource PALLIDIUM_FULL =SurfaceRules.state(EndBlocks.PALLIDIUM_FULL.defaultBlockState());
|
||||
protected static final SurfaceRules.RuleSource PALLIDIUM_HEAVY =SurfaceRules.state(EndBlocks.PALLIDIUM_HEAVY.defaultBlockState());
|
||||
protected static final SurfaceRules.RuleSource PALLIDIUM_THIN =SurfaceRules.state(EndBlocks.PALLIDIUM_THIN.defaultBlockState());
|
||||
protected static final SurfaceRules.RuleSource PALLIDIUM_TINY =SurfaceRules.state(EndBlocks.PALLIDIUM_TINY.defaultBlockState());
|
||||
protected static final SurfaceRules.RuleSource UMBRALITH =SurfaceRules.state(EndBlocks.UMBRALITH.stone.defaultBlockState());
|
||||
|
||||
public final ResourceLocation ID;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class SulphurSpringsBiome extends EndBiome.Config {
|
|||
@Override
|
||||
protected void addCustomBuildData(BCLBiomeBuilder builder) {
|
||||
builder
|
||||
//TODO: 1.18 surface Rules
|
||||
//TODO: 1.18 check surface Rules
|
||||
//.surface(SurfaceBuilders.SULPHURIC_SURFACE.configured(SurfaceBuilders.DEFAULT_END_CONFIG))
|
||||
.surface(
|
||||
SurfaceRules.sequence(
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.surface.UmbraSurfaceNoiseCondition;
|
||||
|
||||
public class UmbraValleyBiome extends EndBiome.Config {
|
||||
public UmbraValleyBiome() {
|
||||
|
@ -16,8 +18,18 @@ public class UmbraValleyBiome extends EndBiome.Config {
|
|||
builder.fogColor(100, 100, 100)
|
||||
.plantsColor(172, 189, 190)
|
||||
.waterAndFogColor(69, 104, 134)
|
||||
//TODO: 1.18 surface Rules
|
||||
//TODO: 1.18 check surface Rules
|
||||
//.surface(SurfaceBuilders.UMBRA_SURFACE.configured(SurfaceBuilders.DEFAULT_END_CONFIG))
|
||||
.surface(
|
||||
SurfaceRules.sequence(
|
||||
SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(0.4), PALLIDIUM_FULL),
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(0.15), PALLIDIUM_HEAVY),
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(-0.15), PALLIDIUM_THIN),
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(-0.4), PALLIDIUM_TINY)
|
||||
)), UMBRALITH
|
||||
)
|
||||
)
|
||||
.particles(EndParticles.AMBER_SPHERE, 0.0001F)
|
||||
.loop(EndSounds.UMBRA_VALLEY)
|
||||
.music(EndSounds.MUSIC_DARK)
|
||||
|
|
|
@ -13,9 +13,10 @@ public class SulphuricSurfaceNoiseCondition extends SurfaceNoiseCondition {
|
|||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
private int lastX = Integer.MIN_VALUE;
|
||||
private int lastZ = Integer.MIN_VALUE;
|
||||
private double lastValue = 0;
|
||||
private static int lastX = Integer.MIN_VALUE;
|
||||
private static int lastZ = Integer.MIN_VALUE;
|
||||
private static double lastValue = 0;
|
||||
|
||||
@Override
|
||||
public boolean test(SurfaceRulesContextAccessor context) {
|
||||
final int x = context.getBlockX();
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package ru.betterend.world.surface;
|
||||
|
||||
import ru.bclib.api.biomes.SurfaceNoiseCondition;
|
||||
import ru.bclib.mixin.common.SurfaceRulesContextAccessor;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
public class UmbraSurfaceNoiseCondition extends SurfaceNoiseCondition {
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(1512);
|
||||
|
||||
private final double threshold;
|
||||
public UmbraSurfaceNoiseCondition(double threshold){
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
private static int lastX = Integer.MIN_VALUE;
|
||||
private static int lastZ = Integer.MIN_VALUE;
|
||||
private static double lastValue = 0;
|
||||
|
||||
@Override
|
||||
public boolean test(SurfaceRulesContextAccessor context) {
|
||||
final int x = context.getBlockX();
|
||||
final int z = context.getBlockZ();
|
||||
if (lastX==x && lastZ==z) return lastValue > threshold;
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
lastX=x;
|
||||
lastZ=z;
|
||||
lastValue=value;
|
||||
return value > threshold;
|
||||
//int depth = (int) (NOISE.eval(x * 0.1, z * 0.1) * 20 + NOISE.eval(x * 0.5, z * 0.5) * 10 + 60);
|
||||
//SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise + depth, defaultBlock, defaultFluid, seaLevel, seed, n, config);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue