Additional cave biomes
This commit is contained in:
parent
3daf3421ee
commit
2ac1ec8f5a
6 changed files with 133 additions and 0 deletions
|
@ -0,0 +1,48 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.sdf.SDF;
|
||||
import ru.betterend.util.sdf.operator.SDFRotation;
|
||||
import ru.betterend.util.sdf.primitive.SDFHexPrism;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class BigAuroraCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||
int maxY = pos.getY() + BlocksHelper.upRay(world, pos, 16);
|
||||
int minY = pos.getY() - BlocksHelper.downRay(world, pos, 16);
|
||||
|
||||
if (maxY - minY < 10) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int y = MHelper.randRange(minY, maxY, random);
|
||||
pos = new BlockPos(pos.getX(), y, pos.getZ());
|
||||
|
||||
int height = MHelper.randRange(5, 25, random);
|
||||
SDF prism = new SDFHexPrism().setHeight(height).setRadius(MHelper.randRange(1.7F, 3F, random)).setBlock(EndBlocks.AURORA_CRYSTAL);
|
||||
Vector3f vec = MHelper.randomHorizontal(random);
|
||||
prism = new SDFRotation().setRotation(vec, random.nextFloat()).setSource(prism);
|
||||
prism.setReplaceFunction((bState) -> {
|
||||
return bState.getMaterial().isReplaceable()
|
||||
|| bState.isIn(EndTags.GEN_TERRAIN)
|
||||
|| bState.getMaterial().equals(Material.PLANT)
|
||||
|| bState.getMaterial().equals(Material.LEAVES);
|
||||
});
|
||||
prism.fillRecursive(world, pos);
|
||||
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.AURORA_CRYSTAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue