Migrated to SurfaceBuilder
This commit is contained in:
parent
ce727b2633
commit
65dd58d86f
23 changed files with 137 additions and 94 deletions
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.api.surface.SurfaceRuleBuilder;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.bclib.world.biomes.BCLBiome;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
@ -38,6 +39,28 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
public BlockState getUnderMaterial() {
|
||||
return END_STONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateFloorRule(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceRuleBuilder surface() {
|
||||
SurfaceRuleBuilder builder = SurfaceRuleBuilder
|
||||
.start()
|
||||
.filler(getUnderMaterial())
|
||||
;
|
||||
|
||||
if (generateFloorRule() && getTopMaterial()!=getUnderMaterial()){
|
||||
if (getTopMaterial()!=getAltTopMaterial()){
|
||||
builder.floor(getTopMaterial());
|
||||
} else {
|
||||
builder.chancedFloor(getTopMaterial(), getAltTopMaterial());
|
||||
}
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class Config {
|
||||
|
@ -94,7 +117,8 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
.mood(EndSounds.AMBIENT_DUST_WASTELANDS)
|
||||
.temperature(0.5f)
|
||||
.wetness(0.5f)
|
||||
.precipitation(Biome.Precipitation.NONE);
|
||||
.precipitation(Biome.Precipitation.NONE)
|
||||
.surface(biomeConfig.surfaceMaterial().surface().build());
|
||||
|
||||
biomeConfig.addCustomBuildData(builder);
|
||||
EndFeatures.addDefaultFeatures(builder, biomeConfig.hasCaves());
|
||||
|
@ -118,6 +142,7 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
return surfMatProv.getTopMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getUnderMaterial() {
|
||||
return surfMatProv.getUnderMaterial();
|
||||
}
|
||||
|
@ -127,6 +152,12 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
return surfMatProv.getAltTopMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateFloorRule() { return surfMatProv.generateFloorRule(); }
|
||||
|
||||
@Override
|
||||
public SurfaceRuleBuilder surface() { return surfMatProv.surface(); }
|
||||
|
||||
public static BlockState findTopMaterial(BCLBiome biome){
|
||||
return BiomeAPI.findTopMaterial(biome).orElse(EndBiome.Config.DEFAULT_MATERIAL.getTopMaterial());
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
@ -58,11 +59,21 @@ public class LushAuroraCaveBiome extends EndCaveBiome.Config {
|
|||
.plantsColor(108, 25, 46)
|
||||
.waterAndFogColor(186, 77, 237)
|
||||
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
|
||||
.surface(EndBlocks.CAVE_MOSS);
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiFunction<ResourceLocation, net.minecraft.world.level.biome.Biome, EndBiome> getSupplier() {
|
||||
return LushAuroraCaveBiome.Biome::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SurfaceMaterialProvider surfaceMaterial() {
|
||||
return new EndBiome.DefaultSurfaceMaterialProvider() {
|
||||
@Override
|
||||
public BlockState getTopMaterial() {
|
||||
return EndBlocks.CAVE_MOSS.defaultBlockState();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package ru.betterend.world.biome.cave;
|
|||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
@ -42,12 +44,21 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
|
|||
.fogDensity(2.0F)
|
||||
.plantsColor(0, 131, 145)
|
||||
.waterAndFogColor(31, 167, 212)
|
||||
.particles(EndParticles.SMARAGDANT, 0.001F)
|
||||
.surface(EndBlocks.CAVE_MOSS);
|
||||
.particles(EndParticles.SMARAGDANT, 0.001F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiFunction<ResourceLocation, net.minecraft.world.level.biome.Biome, EndBiome> getSupplier() {
|
||||
return LushSmaragdantCaveBiome.Biome::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SurfaceMaterialProvider surfaceMaterial() {
|
||||
return new EndBiome.DefaultSurfaceMaterialProvider() {
|
||||
@Override
|
||||
public BlockState getTopMaterial() {
|
||||
return EndBlocks.CAVE_MOSS.defaultBlockState();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public class AmberLandBiome extends EndBiome.Config {
|
|||
.music(EndSounds.MUSIC_FOREST)
|
||||
.loop(EndSounds.AMBIENT_AMBER_LAND)
|
||||
.particles(EndParticles.AMBER_SPHERE, 0.001F)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.feature(EndFeatures.AMBER_ORE)
|
||||
.feature(EndFeatures.END_LAKE_RARE)
|
||||
.feature(EndFeatures.HELIX_TREE)
|
||||
|
|
|
@ -25,7 +25,6 @@ public class BlossomingSpiresBiome extends EndBiome.Config {
|
|||
builder.fogColor(241, 146, 229)
|
||||
.fogDensity(1.7F)
|
||||
.plantsColor(122, 45, 122)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.music(EndSounds.MUSIC_FOREST)
|
||||
.loop(EndSounds.AMBIENT_BLOSSOMING_SPIRES)
|
||||
.feature(EndFeatures.SPIRE)
|
||||
|
|
|
@ -24,7 +24,6 @@ public class ChorusForestBiome extends EndBiome.Config {
|
|||
.fogDensity(1.5F)
|
||||
.plantsColor(122, 45, 122)
|
||||
.waterAndFogColor(73, 30, 73)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.particles(ParticleTypes.PORTAL, 0.01F)
|
||||
.loop(EndSounds.AMBIENT_CHORUS_FOREST)
|
||||
.music(EndSounds.MUSIC_DARK)
|
||||
|
|
|
@ -19,7 +19,6 @@ public class CrystalMountainsBiome extends EndBiome.Config {
|
|||
protected void addCustomBuildData(BCLBiomeBuilder builder) {
|
||||
builder.structure(EndStructures.MOUNTAIN.getFeatureConfigured())
|
||||
.plantsColor(255, 133, 211)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.music(EndSounds.MUSIC_OPENSPACE)
|
||||
.feature(EndFeatures.CRYSTAL_GRASS)
|
||||
.spawn(EntityType.ENDERMAN, 50, 1, 2);
|
||||
|
|
|
@ -23,7 +23,6 @@ public class DragonGraveyardsBiome extends EndBiome.Config {
|
|||
.particles(EndParticles.FIREFLY, 0.0007F)
|
||||
.music(EndSounds.MUSIC_OPENSPACE)
|
||||
.loop(EndSounds.AMBIENT_GLOWING_GRASSLANDS)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.waterAndFogColor(203, 59, 167)
|
||||
.plantsColor(244, 46, 79)
|
||||
.feature(EndFeatures.OBSIDIAN_PILLAR_BASEMENT)
|
||||
|
|
|
@ -20,7 +20,6 @@ public class DryShrublandBiome extends EndBiome.Config {
|
|||
.fogDensity(1.2F)
|
||||
.waterAndFogColor(113, 88, 53)
|
||||
.plantsColor(237, 122, 66)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.music(EndSounds.MUSIC_OPENSPACE)
|
||||
.feature(EndFeatures.LUCERNIA_BUSH_RARE)
|
||||
.feature(EndFeatures.ORANGO)
|
||||
|
|
|
@ -19,7 +19,6 @@ public class DustWastelandsBiome extends EndBiome.Config {
|
|||
builder.fogColor(226, 239, 168)
|
||||
.fogDensity(2)
|
||||
.waterAndFogColor(192, 180, 131)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
//TODO: 1.18 removed
|
||||
//.depth(1.5F)
|
||||
.particles(ParticleTypes.WHITE_ASH, 0.01F)
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.betterend.world.biome.land;
|
|||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -25,11 +24,6 @@ public class FoggyMushroomlandBiome extends EndBiome.Config {
|
|||
.fogColor(41, 122, 173)
|
||||
.fogDensity(3)
|
||||
.waterAndFogColor(119, 227, 250)
|
||||
.chancedSurface(
|
||||
SurfaceRules.state(surfaceMaterial().getTopMaterial()),
|
||||
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
|
||||
END_STONE
|
||||
)
|
||||
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
|
||||
.loop(EndSounds.AMBIENT_FOGGY_MUSHROOMLAND)
|
||||
.music(EndSounds.MUSIC_FOREST)
|
||||
|
|
|
@ -22,7 +22,6 @@ public class GlowingGrasslandsBiome extends EndBiome.Config {
|
|||
.particles(EndParticles.FIREFLY, 0.001F)
|
||||
.music(EndSounds.MUSIC_OPENSPACE)
|
||||
.loop(EndSounds.AMBIENT_GLOWING_GRASSLANDS)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.waterAndFogColor(92, 250, 230)
|
||||
.plantsColor(73, 210, 209)
|
||||
.feature(EndFeatures.END_LAKE_RARE)
|
||||
|
|
|
@ -21,7 +21,6 @@ public class LanternWoodsBiome extends EndBiome.Config {
|
|||
.fogDensity(1.1F)
|
||||
.waterAndFogColor(171, 234, 226)
|
||||
.plantsColor(254, 85, 57)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.music(EndSounds.MUSIC_FOREST)
|
||||
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
|
||||
.feature(EndFeatures.END_LAKE_NORMAL)
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.betterend.world.biome.land;
|
|||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -26,11 +25,6 @@ public class MegalakeBiome extends EndBiome.Config {
|
|||
.fogDensity(1.75F)
|
||||
.music(EndSounds.MUSIC_WATER)
|
||||
.loop(EndSounds.AMBIENT_MEGALAKE)
|
||||
.chancedSurface(
|
||||
SurfaceRules.state(surfaceMaterial().getTopMaterial()),
|
||||
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
|
||||
END_STONE
|
||||
)
|
||||
//TODO: 1.18 removed
|
||||
//.depth(0F)
|
||||
.feature(EndFeatures.END_LOTUS)
|
||||
|
|
|
@ -27,7 +27,6 @@ public class MegalakeGroveBiome extends EndBiome.Config {
|
|||
.particles(EndParticles.GLOWING_SPHERE, 0.001F)
|
||||
.music(EndSounds.MUSIC_WATER)
|
||||
.loop(EndSounds.AMBIENT_MEGALAKE_GROVE)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
//TODO: 1.18 removed
|
||||
//.depth(0F)
|
||||
.feature(EndFeatures.LACUGROVE)
|
||||
|
|
|
@ -3,7 +3,6 @@ package ru.betterend.world.biome.land;
|
|||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -22,11 +21,6 @@ public class NeonOasisBiome extends EndBiome.Config {
|
|||
.fogColor(226, 239, 168)
|
||||
.fogDensity(2)
|
||||
.waterAndFogColor(106, 238, 215)
|
||||
.chancedSurface(
|
||||
SurfaceRules.state(surfaceMaterial().getTopMaterial()),
|
||||
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
|
||||
END_STONE
|
||||
)
|
||||
.particles(ParticleTypes.WHITE_ASH, 0.01F)
|
||||
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
|
||||
.music(EndSounds.MUSIC_OPENSPACE)
|
||||
|
|
|
@ -23,7 +23,6 @@ public class PaintedMountainsBiome extends EndBiome.Config {
|
|||
.waterAndFogColor(192, 180, 131)
|
||||
.music(EndSounds.MUSIC_OPENSPACE)
|
||||
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.particles(ParticleTypes.WHITE_ASH, 0.01F)
|
||||
.spawn(EntityType.ENDERMAN, 50, 1, 2);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ public class ShadowForestBiome extends EndBiome.Config {
|
|||
.fogDensity(2.5F)
|
||||
.plantsColor(45, 45, 45)
|
||||
.waterAndFogColor(42, 45, 80)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.particles(ParticleTypes.MYCELIUM, 0.01F)
|
||||
.loop(EndSounds.AMBIENT_CHORUS_FOREST)
|
||||
.music(EndSounds.MUSIC_DARK)
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.api.surface.SurfaceRuleBuilder;
|
||||
import ru.bclib.api.surface.rules.SwitchRuleSource;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndEntities;
|
||||
|
@ -27,13 +31,6 @@ public class SulphurSpringsBiome extends EndBiome.Config {
|
|||
@Override
|
||||
protected void addCustomBuildData(BCLBiomeBuilder builder) {
|
||||
builder
|
||||
.surface(
|
||||
SurfaceRules.sequence(
|
||||
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(-0.6), SurfaceRules.state(surfaceMaterial().getAltTopMaterial())),
|
||||
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(-0.3), SurfaceRules.state(surfaceMaterial().getTopMaterial())),
|
||||
SurfaceRules.ifTrue(new SulphuricSurfaceNoiseCondition(0.5), SULPHURIC_ROCK),
|
||||
BRIMSTONE
|
||||
))
|
||||
.music(EndSounds.MUSIC_OPENSPACE)
|
||||
.loop(EndSounds.AMBIENT_SULPHUR_SPRINGS)
|
||||
.waterColor(25, 90, 157)
|
||||
|
@ -68,6 +65,30 @@ public class SulphurSpringsBiome extends EndBiome.Config {
|
|||
public BlockState getAltTopMaterial() {
|
||||
return Blocks.END_STONE.defaultBlockState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateFloorRule() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceRuleBuilder surface() {
|
||||
return super
|
||||
.surface()
|
||||
.rule(
|
||||
SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR,
|
||||
new SwitchRuleSource(
|
||||
new SulphuricSurfaceNoiseCondition(),
|
||||
List.of(
|
||||
SurfaceRules.state(surfaceMaterial().getAltTopMaterial()),
|
||||
SurfaceRules.state(surfaceMaterial().getTopMaterial()),
|
||||
SULPHURIC_ROCK,
|
||||
BRIMSTONE
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.api.surface.SurfaceRuleBuilder;
|
||||
import ru.bclib.api.surface.rules.SwitchRuleSource;
|
||||
import ru.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
@ -21,16 +25,6 @@ public class UmbraValleyBiome extends EndBiome.Config {
|
|||
builder.fogColor(100, 100, 100)
|
||||
.plantsColor(172, 189, 190)
|
||||
.waterAndFogColor(69, 104, 134)
|
||||
.surface(
|
||||
SurfaceRules.sequence(
|
||||
SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(0.4), SurfaceRules.state(surfaceMaterial().getAltTopMaterial())),
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(0.15), PALLIDIUM_HEAVY),
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(-0.15), PALLIDIUM_THIN),
|
||||
SurfaceRules.ifTrue(new UmbraSurfaceNoiseCondition(-0.4), PALLIDIUM_TINY)
|
||||
)), SurfaceRules.state(surfaceMaterial().getTopMaterial())
|
||||
)
|
||||
)
|
||||
.particles(EndParticles.AMBER_SPHERE, 0.0001F)
|
||||
.loop(EndSounds.UMBRA_VALLEY)
|
||||
.music(EndSounds.MUSIC_DARK)
|
||||
|
@ -52,6 +46,31 @@ public class UmbraValleyBiome extends EndBiome.Config {
|
|||
public BlockState getAltTopMaterial() {
|
||||
return EndBlocks.PALLIDIUM_FULL.defaultBlockState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateFloorRule() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceRuleBuilder surface() {
|
||||
return super
|
||||
.surface()
|
||||
.rule(
|
||||
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())
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ public class UmbrellaJungleBiome extends EndBiome.Config {
|
|||
.particles(EndParticles.JUNGLE_SPORE, 0.001F)
|
||||
.music(EndSounds.MUSIC_FOREST)
|
||||
.loop(EndSounds.AMBIENT_UMBRELLA_JUNGLE)
|
||||
.surface(surfaceMaterial().getTopMaterial())
|
||||
.feature(EndFeatures.END_LAKE)
|
||||
.feature(EndFeatures.UMBRELLA_TREE)
|
||||
.feature(EndFeatures.JELLYSHROOM)
|
||||
|
|
|
@ -1,37 +1,28 @@
|
|||
package ru.betterend.world.surface;
|
||||
|
||||
import ru.bclib.api.surface.rules.SurfaceNoiseCondition;
|
||||
import ru.bclib.interfaces.NumericProvider;
|
||||
import ru.bclib.mixin.common.SurfaceRulesContextAccessor;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
public class SulphuricSurfaceNoiseCondition extends SurfaceNoiseCondition {
|
||||
/**
|
||||
* Noise source that returns a value in [0, 3]
|
||||
*/
|
||||
public class SulphuricSurfaceNoiseCondition implements NumericProvider {
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(5123);
|
||||
|
||||
private final double threshold;
|
||||
public SulphuricSurfaceNoiseCondition(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) {
|
||||
public int getNumber(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(
|
||||
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
|
||||
);
|
||||
|
||||
lastX=x;
|
||||
lastZ=z;
|
||||
lastValue=value;
|
||||
return value < threshold;
|
||||
if (value < -0.6) return 0;
|
||||
if (value < -0.3) return 1;
|
||||
if (value < -0.5) return 2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,29 @@
|
|||
package ru.betterend.world.surface;
|
||||
|
||||
import ru.bclib.api.surface.rules.SurfaceNoiseCondition;
|
||||
import ru.bclib.interfaces.NumericProvider;
|
||||
import ru.bclib.mixin.common.SurfaceRulesContextAccessor;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
public class UmbraSurfaceNoiseCondition extends SurfaceNoiseCondition {
|
||||
/**
|
||||
* Noise source that returns a value in [0, 4]
|
||||
*/
|
||||
public class UmbraSurfaceNoiseCondition implements NumericProvider {
|
||||
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) {
|
||||
public int getNumber(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(
|
||||
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
|
||||
);
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue