Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Fixed #263, litte bit of worldgen configs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJake222 committed Jan 14, 2021
1 parent d68d95c commit f4233c4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/main/java/mrjake/aunis/config/AunisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class AunisConfig {
@Name("Audio/Video")
public static AudioVideoConfig avConfig = new AudioVideoConfig();

@Name("WorldGen config")
public static WorldGenConfig worldgenConfig = new WorldGenConfig();

public static class StargateConfig {
@Name("Orlin's gate max open count")
@RangeInt(min=0)
Expand Down Expand Up @@ -283,6 +286,17 @@ public static class AudioVideoConfig {
public float pageNarrowing = 0;
}

public static class WorldGenConfig {
@Name("Enable Naquadah ore generation")
public boolean naquadahEnable = true;

@Name("Naquadah vein size")
public int naquadahVeinSize = 8;

@Name("Naquadah max veins in chunk")
public int naquadahMaxVeinInChunk = 16;
}

public static void resetCache() {
stargateConfig.cachedInvincibleBlocks = null;
stargateConfig.cachedJungleBiomes = null;
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/mrjake/aunis/worldgen/AunisWorldGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.common.base.Predicate;

import mrjake.aunis.block.AunisBlocks;
import mrjake.aunis.config.AunisConfig;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.pattern.BlockMatcher;
import net.minecraft.init.Blocks;
Expand All @@ -25,7 +26,10 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen

switch(world.provider.getDimensionType()) {
case NETHER:
runGenerator(AunisBlocks.ORE_NAQUADAH_BLOCK.getDefaultState(), 8, 16, 0, 256, BlockMatcher.forBlock(Blocks.NETHERRACK), world, rand, chunkX, chunkZ);
if (AunisConfig.worldgenConfig.naquadahEnable) {
runGenerator(AunisBlocks.ORE_NAQUADAH_BLOCK.getDefaultState(), AunisConfig.worldgenConfig.naquadahVeinSize, AunisConfig.worldgenConfig.naquadahMaxVeinInChunk, 0, 128, BlockMatcher.forBlock(Blocks.NETHERRACK), world, rand, chunkX, chunkZ);
}

break;

default:
Expand All @@ -42,11 +46,13 @@ private void runGenerator(IBlockState blockToGen, int blockAmount, int chancesTo
WorldGenMinable generator = new WorldGenMinable(blockToGen, blockAmount, blockToReplace);

int heightDiff = maxHeight - minHeight;

int bx = chunkX * 16 + 2;
int bz = chunkZ * 16 + 2;

for(int i=0; i<chancesToSpawn; i++) {
int x = chunkX * 16 +rand.nextInt(16);
int x = bx + rand.nextInt(16-4);
int y = minHeight + rand.nextInt(heightDiff);
int z = chunkZ * 16 + rand.nextInt(16);
int z = bz + rand.nextInt(16-4);

generator.generate(world, rand, new BlockPos(x,y,z));
}
Expand Down

0 comments on commit f4233c4

Please sign in to comment.