Neon Oasis surface fix
This commit is contained in:
parent
f668a3b0ef
commit
a307cb7dc5
3 changed files with 50 additions and 1 deletions
|
@ -2,13 +2,23 @@ package ru.betterend.world.biome.land;
|
||||||
|
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.world.entity.EntityType;
|
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.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||||
|
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
|
||||||
|
import net.minecraft.world.level.levelgen.placement.CaveSurface;
|
||||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
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.bclib.interfaces.SurfaceMaterialProvider;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
import ru.betterend.registry.EndSounds;
|
import ru.betterend.registry.EndSounds;
|
||||||
import ru.betterend.world.biome.EndBiome;
|
import ru.betterend.world.biome.EndBiome;
|
||||||
|
import ru.betterend.world.surface.SplitNoiseCondition;
|
||||||
|
import ru.betterend.world.surface.SulphuricSurfaceNoiseCondition;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class NeonOasisBiome extends EndBiome.Config {
|
public class NeonOasisBiome extends EndBiome.Config {
|
||||||
public NeonOasisBiome() {
|
public NeonOasisBiome() {
|
||||||
|
@ -47,6 +57,24 @@ public class NeonOasisBiome extends EndBiome.Config {
|
||||||
public BlockState getAltTopMaterial() {
|
public BlockState getAltTopMaterial() {
|
||||||
return EndBlocks.END_MOSS.defaultBlockState();
|
return EndBlocks.END_MOSS.defaultBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SurfaceRuleBuilder surface() {
|
||||||
|
RuleSource surfaceBlockRule = new SwitchRuleSource(
|
||||||
|
new SplitNoiseCondition(),
|
||||||
|
List.of(
|
||||||
|
SurfaceRules.state(EndBlocks.ENDSTONE_DUST.defaultBlockState()),
|
||||||
|
SurfaceRules.state(EndBlocks.END_MOSS.defaultBlockState())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return super
|
||||||
|
.surface()
|
||||||
|
.ceil(Blocks.END_STONE.defaultBlockState())
|
||||||
|
.rule(1, SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, surfaceBlockRule))
|
||||||
|
.rule(4, SurfaceRules.ifTrue(SurfaceRules.stoneDepthCheck(5, false, false, CaveSurface.FLOOR),
|
||||||
|
SurfaceRules.state(EndBlocks.ENDSTONE_DUST.defaultBlockState())
|
||||||
|
));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package ru.betterend.world.surface;
|
||||||
|
|
||||||
|
import ru.bclib.interfaces.NumericProvider;
|
||||||
|
import ru.bclib.mixin.common.SurfaceRulesContextAccessor;
|
||||||
|
import ru.bclib.util.MHelper;
|
||||||
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Noise source that returns a value in [0, 1]
|
||||||
|
*/
|
||||||
|
public class SplitNoiseCondition implements NumericProvider {
|
||||||
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(4141);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumber(SurfaceRulesContextAccessor context) {
|
||||||
|
final int x = context.getBlockX();
|
||||||
|
final int z = context.getBlockZ();
|
||||||
|
float noise = (float) NOISE.eval(x * 0.1, z * 0.1) + MHelper.randRange(-0.4F, 0.4F, MHelper.RANDOM);
|
||||||
|
return noise > 0 ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,7 +45,7 @@
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.12.9",
|
"fabricloader": ">=0.12.9",
|
||||||
"fabric": ">=0.44.0",
|
"fabric": ">=0.44.0",
|
||||||
"minecraft": ">=1.18.x",
|
"minecraft": "1.18.x",
|
||||||
"bclib": ">=1.1.6"
|
"bclib": ">=1.1.6"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue