Skip to content

Instantly share code, notes, and snippets.

@JayZX535 JayZX535/StructureGen.java Secret
Created Jan 26, 2016

Embed
What would you like to do?
package com.caninemod.caninemod.structures;
import java.util.Random;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
public class StructureGen implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case -1: generateNether(world, random, chunkX*16, chunkZ*16);
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
if (world.getBiomeGenForCoords(blockX, blockZ) == BiomeGenBase.plains)
{
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(5);
if (randomInt == 1)
{
int Xcoord1 = blockX + random.nextInt(16);
int Ycoord1 = random.nextInt(80);
int Zcoord1 = blockZ + random.nextInt(16);
(new OldRuin()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}
private void generateNether(World world, Random random, int blockX, int blockZ)
{
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(3);
if (randomInt == 1)
{
int Xcoord1 = blockX + random.nextInt(16);
int Ycoord1 = random.nextInt(80);
int Zcoord1 = blockZ + random.nextInt(16);
(new NetherDogDungeon()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.