Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ public void generateTerrain(int chunkX, int chunkZ, ChunkPrimer primer) {
// Loop through z axis
for (int jZ = 0; jZ < 4; ++jZ) {
// If the noiseLevel is above 0, set block to stone.
if (height < 2) {
primer.setBlockState(iX * 4 + jX, iY * 8 + jY, iZ * 4 + jZ, bedrock);
} else if ((zVariation += d16) > 0.0D) {
if (height < 2 || (zVariation += d16) > 0.0D) {
primer.setBlockState(iX * 4 + jX, iY * 8 + jY, iZ * 4 + jZ, stone);
}

Expand Down Expand Up @@ -490,34 +488,6 @@ public void populate(int x, int z) {

// Call biome decoration first
biome.decorate(this.world, this.rand, blockpos);

// Generate pit entrances to lava tubes
generatePitEntrances(x, z, blockpos);
}

private void generatePitEntrances(int chunkX, int chunkZ, BlockPos chunkPos) {
// Use chunk-based random with world seed
Random pitRand = new Random(world.getSeed() +
(long) chunkX * 341873128712L + (long) chunkZ * 132897987541L);

// Low probability of pit entrance per chunk (adjust as needed)
if (pitRand.nextDouble() < 0.02) { // 2% chance per chunk
// Random position within chunk
int x = chunkPos.getX() + pitRand.nextInt(16);
int z = chunkPos.getZ() + pitRand.nextInt(16);

// Find surface height
int y = world.getHeight(x, z);

// Create a marker block that WorldGenPit will use to determine size
// The metadata determines the pit size (0-15, where size = meta + 1)
int size = 2 + pitRand.nextInt(6); // Size 3-8

BlockPos pitPos = new BlockPos(x, y, z);

// Generate the pit
pitGenerator.generate(world, pitRand, pitPos);
}
}

public boolean generateStructures(Chunk chunkIn, int x, int z) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package supersymmetry.common.world.biome;

import java.util.Random;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.gen.feature.WorldGenerator;

import supersymmetry.common.world.gen.MapGenLunarLavaTube;
import supersymmetry.common.world.gen.WorldGenPit;

public class BiomePlanetaryDecorator extends BiomeDecorator {

public WorldGenerator pitGen = new WorldGenPit();

@Override
public void decorate(World worldIn, Random random, Biome biome, BlockPos pos) {
for (int i = 0; i < 16; i += 2) {
for (int j = 0; j < 16; j += 2) {
BlockPos position = new BlockPos(pos.getX() + i, 0x60, pos.getZ() + j);
if (worldIn.getBlockState(position).getBlock() == MapGenLunarLavaTube.PIT) {
pitGen.generate(worldIn, random, position);
}
}
}
}

private static class NoGenerator extends WorldGenerator {

public static WorldGenerator noGen = new NoGenerator();

@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
return false;
}
}
}
18 changes: 3 additions & 15 deletions src/main/java/supersymmetry/common/world/biome/PlanetaryBiome.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,13 @@ public class PlanetaryBiome extends Biome {

public PlanetaryBiome(BiomeProperties properties) {
super(properties);
this.decorator.generateFalls = false;
this.decorator.flowersPerChunk = 0;
this.decorator.grassPerChunk = 0;
this.decorator.treesPerChunk = 0;

// mushrooms still generate with mushroomsPerChunk = 0;
this.decorator.mushroomsPerChunk = 0;
this.decorator.cactiPerChunk = 0;
this.decorator.deadBushPerChunk = 0;
this.decorator.reedsPerChunk = 0;
this.decorator.sandPatchesPerChunk = 0;
this.decorator.gravelPatchesPerChunk = 0;
this.decorator.clayPerChunk = 0;
this.decorator.bigMushroomsPerChunk = 0;
this.decorator = new BiomePlanetaryDecorator();
}

@Override
public void decorate(World worldIn, Random rand, BlockPos pos) {
// Empty, prevents all vanilla decoration including structures
// BiomePlanetaryDecorator is set to not generate vanilla decorations
this.decorator.decorate(worldIn, rand, this, pos);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class MapGenLunarLavaTube extends MapGenBase {
protected static final IBlockState AIR = Blocks.AIR.getDefaultState();
public static final IBlockState BASALT = MetaBlocks.STONE_BLOCKS.get(StoneVariantBlock.StoneVariant.SMOOTH)
.getState(StoneVariantBlock.StoneType.BASALT);
public static final Block PIT = Blocks.END_PORTAL_FRAME;

// modified from net.minecraft.world.gen.MapGenCaves
protected void addTunnel(long seed, int x, int z, ChunkPrimer primer, double startX, double startY, double startZ,
Expand Down Expand Up @@ -143,6 +144,11 @@ protected void addTunnel(long seed, int x, int z, ChunkPrimer primer, double sta

int x3 = MathHelper.floor(startX) - x * 16;
int z3 = MathHelper.floor(startZ) - z * 16;
if (0 <= x3 && x3 < 16 && 0 <= z3 && z3 < 16 && width > 0x3 && x3 % 2 == 0 && z3 % 2 == 0 &&
localRandom.nextInt(0x2) == 1 && y2 > primer.findGroundBlockIdx(x3, z3) - 2) {
fillBlock(primer, x3, 0x60, z3, null, AIR,
PIT.getStateFromMeta(width > 0xa ? 7 : (int) (width - 3)));
}

// lx: local x
for (int localX = x1; localX < x2; ++localX) {
Expand Down Expand Up @@ -190,7 +196,7 @@ protected void addTunnel(long seed, int x, int z, ChunkPrimer primer, double sta
protected boolean canReplaceBlock(IBlockState state, IBlockState up) {
Block block = state.getBlock();
return block == SuSyBlocks.SUSY_STONE_BLOCKS.get(SusyStoneVariantBlock.StoneVariant.SMOOTH) ||
block == SuSyBlocks.REGOLITH ||
// block == SuSyBlocks.REGOLITH ||
block == MetaBlocks.STONE_BLOCKS.get(StoneVariantBlock.StoneVariant.SMOOTH) || block == Blocks.AIR;
}

Expand All @@ -207,11 +213,11 @@ protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int orig
ChunkPrimer chunkPrimerIn) {
int i = 1;

if (this.rand.nextInt(16) == 0) {
if (this.rand.nextInt(8) == 0) {
i = rand.nextInt(2);
}

if (this.rand.nextInt(0x30) != 0) {
if (this.rand.nextInt(0x38) != 0) {
i = 0;
}

Expand Down Expand Up @@ -253,8 +259,7 @@ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int c
IBlockState top = biome.topBlock;
IBlockState filler = biome.fillerBlock;

if (this.canReplaceBlock(state, up) || state.getBlock() == top.getBlock() ||
state.getBlock() == filler.getBlock()) {
if (this.canReplaceBlock(state, up)) {
if (y < 6) {
data.setBlockState(x, y, z, BASALT);
} else {
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/supersymmetry/common/world/gen/WorldGenPit.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,30 @@ public class WorldGenPit extends WorldGenerator {
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
IBlockState state = worldIn.getBlockState(position);
int size = state.getBlock().getMetaFromState(state) + 1;
int size = state.getBlock().getMetaFromState(state) + 2;
worldIn.setBlockState(position, AIR, 2);
IBlockState biomeBlock = worldIn.getBiome(position).topBlock;

for (int x = -size; x <= size; x++) {
for (int z = -size; z <= size; z++) {
if (x * x + z * z <= size * size * rand.nextFloat(0x.cp0f, 0x1.4p0f)) {
if (x * x + z * z <= size * size * rand.nextFloat(0x.ep0f, 0x1.4p0f)) {
int top = worldIn.getHeight(position.getX() + x, position.getZ() + z);
if (top < 0x40) top = 0x40;
// if (top < 0x40) top = 0x40;
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(position.getX() + x, top,
position.getZ() + z);

for (int i = 0; i < 5; i++) {
worldIn.setBlockState(pos, AIR, 2);
if (worldIn.getBlockState(pos) == biomeBlock) worldIn.setBlockState(pos, AIR, 2);
pos.move(EnumFacing.DOWN);
}
pos.move(EnumFacing.UP, 5);

for (int i = 0; i < 0x20 && worldIn.getBlockState(pos) != MapGenLunarLavaTube.BASALT; i++) {
for (int i = 0; i < 0x28 && worldIn.getBlockState(pos) != MapGenLunarLavaTube.BASALT; i++) {
pos.move(EnumFacing.DOWN);
}

int height = (int) (size * size * rand.nextFloat(0x.8p0f, 0x1.8p0f) / (x * x + z * z + size));
int height = (int) (size * size * rand.nextFloat(0x.8p0f, 0x1.0p0f) / (x * x + z * z + size)) +
rand.nextInt(1) + 1;
for (int i = 0; i < height; i++) {
pos.move(EnumFacing.UP);
worldIn.setBlockState(pos, biomeBlock, 2);
Expand Down
Loading