Cave fix
This commit is contained in:
parent
1a2ec137f1
commit
53bbc33f22
3 changed files with 16 additions and 3 deletions
|
@ -8,7 +8,7 @@
|
||||||
loader_version = 0.10.1+build.209
|
loader_version = 0.10.1+build.209
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.3.1-alpha
|
mod_version = 0.3.2-alpha
|
||||||
maven_group = ru.betterend
|
maven_group = ru.betterend
|
||||||
archives_base_name = better-end
|
archives_base_name = better-end
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,26 @@ import ru.betterend.util.sdf.primitive.SDFSphere;
|
||||||
public class RoundCaveFeature extends DefaultFeature {
|
public class RoundCaveFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||||
|
if (pos.getX() * pos.getX() + pos.getZ() * pos.getZ() <= 22500) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int radius = MHelper.randRange(10, 30, random);
|
int radius = MHelper.randRange(10, 30, random);
|
||||||
int bottom = BlocksHelper.upRay(world, new BlockPos(pos.getX(), 0, pos.getZ()), 32) + radius;
|
int bottom = BlocksHelper.upRay(world, new BlockPos(pos.getX(), 0, pos.getZ()), 32) + radius;
|
||||||
int top = world.getTopY(Heightmap.Type.WORLD_SURFACE, pos.getX(), pos.getZ()) - radius;
|
int top = world.getTopY(Heightmap.Type.WORLD_SURFACE, pos.getX(), pos.getZ()) - radius;
|
||||||
|
|
||||||
|
Mutable bpos = new Mutable();
|
||||||
|
bpos.setX(pos.getX());
|
||||||
|
bpos.setZ(pos.getZ());
|
||||||
|
bpos.setY(top);
|
||||||
|
while (!world.getBlockState(pos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
|
||||||
|
bpos.setY(--top);
|
||||||
|
}
|
||||||
|
|
||||||
if (top <= bottom) {
|
if (top <= bottom) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = new BlockPos(pos.getX(), MHelper.randRange(bottom, top, random), pos.getZ());
|
pos = new BlockPos(pos.getX(), MHelper.randRange(bottom, top, random), pos.getZ());
|
||||||
|
|
||||||
OpenSimplexNoise noise = new OpenSimplexNoise(MHelper.getSeed(534, pos.getX(), pos.getZ()));
|
OpenSimplexNoise noise = new OpenSimplexNoise(MHelper.getSeed(534, pos.getX(), pos.getZ()));
|
||||||
|
@ -52,7 +66,6 @@ public class RoundCaveFeature extends DefaultFeature {
|
||||||
double hr = radius * 0.75;
|
double hr = radius * 0.75;
|
||||||
double nr = radius * 0.25;
|
double nr = radius * 0.25;
|
||||||
|
|
||||||
Mutable bpos = new Mutable();
|
|
||||||
Set<BlockPos> bushes = Sets.newHashSet();
|
Set<BlockPos> bushes = Sets.newHashSet();
|
||||||
BlockState terrain = BlockRegistry.CAVE_MOSS.getDefaultState();
|
BlockState terrain = BlockRegistry.CAVE_MOSS.getDefaultState();
|
||||||
for (int x = x1; x <= x2; x++) {
|
for (int x = x1; x <= x2; x++) {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"Bulldog83"
|
"Bulldog83"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "",
|
"homepage": "https://www.curseforge.com/minecraft/mc-mods/betterend",
|
||||||
"sources": "https://github.com/paulevsGitch/BetterEnd"
|
"sources": "https://github.com/paulevsGitch/BetterEnd"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue