Applied-Energistics-2-tiler.../hooks/QuartzWorldGen.java
AlgorithmX2 d4ff8e731d Added Meteorite Spawn Distance Setting.
Added Charged Quartz Spawn Chance.
All GUI's Parts/Tiles support Custom Localization. ( Fixes #0190 )
Added Crafting Recipe for copying Press Plates.
Fixed Bug: #0189 - Particles don't turn off when set to minimal
Fixed Bug: #0176 - Weird Colorization While Mining Parts.
Fixed Bug: #0152 - TPane drops parts as items and does not insert into system.
Fixed Bug: #0140 - Spatial pylon facade renders oddly (Clear)
2014-03-15 01:58:21 -05:00

54 lines
1.8 KiB
Java

package appeng.hooks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import appeng.api.AEApi;
import appeng.core.AEConfig;
import cpw.mods.fml.common.IWorldGenerator;
final public class QuartzWorldGen implements IWorldGenerator
{
final WorldGenMinable oreNormal;
final WorldGenMinable oreCharged;
public QuartzWorldGen() {
Block normal = AEApi.instance().blocks().blockQuartzOre.block();
Block charged = AEApi.instance().blocks().blockQuartzOreCharged.block();
if ( normal != null && charged != null )
{
oreNormal = new WorldGenMinable( normal, 0, AEConfig.instance.quartzOresPerCluster, Blocks.stone );
oreCharged = new WorldGenMinable( charged, 0, AEConfig.instance.quartzOresPerCluster, Blocks.stone );
}
else
oreNormal = oreCharged = null;
};
@Override
public void generate(Random r, int chunkX, int chunkZ, World w, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
int sealevel = w.provider.getAverageGroundLevel() + 1;
if ( oreNormal == null || oreCharged == null )
return;
double oreDepthMultiplier = 15 * sealevel / 64;
int scale = (int) Math.round( r.nextGaussian() * Math.sqrt( oreDepthMultiplier ) + oreDepthMultiplier );
for (int x = 0; x < (r.nextBoolean() ? scale * 2 : scale) / 2; ++x)
{
WorldGenMinable whichOre = r.nextFloat() > AEConfig.instance.spawnChargedChance ? oreCharged : oreNormal;
int a = chunkX * 16 + r.nextInt( 22 );
int b = r.nextInt( 40 * sealevel / 64 ) + r.nextInt( 22 * sealevel / 64 ) + 12 * sealevel / 64;
int c = chunkZ * 16 + r.nextInt( 22 );
whichOre.generate( w, r, a, b, c );
}
}
}