Java Code Examples for net.minecraft.world.chunk.IChunkGenerator

The following are top voted examples for showing how to use net.minecraft.world.chunk.IChunkGenerator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: CustomWorldGen   File: GameRegistry.java   Source Code and License 6 votes vote down vote up
/**
 * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
 * call this
 *
 * @param chunkX         Chunk X coordinate
 * @param chunkZ         Chunk Z coordinate
 * @param world          World we're generating into
 * @param chunkGenerator The chunk generator
 * @param chunkProvider  The chunk provider
 */
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (sortedGeneratorList == null)
    {
        computeSortedGeneratorList();
    }
    long worldSeed = world.getSeed();
    Random fmlRandom = new Random(worldSeed);
    long xSeed = fmlRandom.nextLong() >> 2 + 1L;
    long zSeed = fmlRandom.nextLong() >> 2 + 1L;
    long chunkSeed = (xSeed * chunkX + zSeed * chunkZ) ^ worldSeed;

    for (IWorldGenerator generator : sortedGeneratorList)
    {
        fmlRandom.setSeed(chunkSeed);
        generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    }
}
 
Example 2
Project: AquaRegia   File: WorldGenOres.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (Config.enableOreGen) {
        final BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);

        switch (world.provider.getDimensionType()) {
            case OVERWORLD:
                for (int i = 0; i < Config.niterPerChunk; i++) {
                    oreGenNiter.generate(world, random, chunkPos.add(random.nextInt(16), random.nextInt(32) + 16, random.nextInt(16)));
                }
                for (int i = 0; i < Config.saltPerChunk; i++) {
                    oreGenSalt.generate(world, random, chunkPos.add(random.nextInt(16), random.nextInt(64) + 32, random.nextInt(16)));
                }
                for (int i = 0; i < Config.sulfurPerChunk; i++) {
                    oreGenSulfur.generate(world, random, chunkPos.add(random.nextInt(16), random.nextInt(24), random.nextInt(16)));
                }
                break;
            case NETHER:
                break;
            case THE_END:
                break;
        }
    }
}
 
Example 3
Project: TAIGA   File: WorldGen.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;
    switch (world.provider.getDimension()) {
        case -1:
            nether(random, x, z, world);
            break;
        case 0:
            world(random, x, z, world);
            break;
        case 1:
            end(random, x, z, world);
            break;
        default:
            if (!blackList.contains(world.provider.getDimension()))
                other(random, x, z, world);
            break;
    }
}
 
Example 4
Project: PrimordialCrops   File: MagicalWorldGen.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
					 IChunkProvider chunkProvider) {

	switch (world.provider.getDimension()) {
		case -1: //Nether

			break;
		case 1: //End

			break;
		default:
			if (PrimordialConfig.enableOreSpawn) {
				this.runGenerator(this.MinicioOre, world, random, chunkX, chunkZ, PrimordialConfig.oreSpawnChance, PrimordialConfig.oreSpawnMinZ, PrimordialConfig.oreSpawnMaxZ);
			}
			break;
	}

}
 
Example 5
Project: HempFarmer   File: HempGen.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {

	switch (world.provider.getDimension()) {
	case 0:
		this.runGenerator(this.hemp, world, random, chunkX, chunkZ, 3);
		this.runGenerator(this.indica, world, random, chunkX, chunkZ, 1);
		this.runGenerator(this.sativa, world, random, chunkX, chunkZ, 1);
		break;
	case -1: // Nether
		break;
	case 1: // End
		break;
	default:
		break;
	}
}
 
Example 6
Project: MobHunter   File: WorldGenHandler.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    int dimId = world.provider.getDimension();
    switch(dimId)
    {
        case -1:
            //Nether
            genNether(world, random, chunkX,  chunkZ);
            break;
        case 1:
            //End
            genEnd(world, random, chunkX,  chunkZ);
            break;
        default:
            //Overworld and other dimensions in the config
            for(int id : Config.plantGenDimIDs)
                if(dimId == id)
                {
                    genOverworld(world, random, chunkX, chunkZ);
                    break;
                }
    }
}
 
Example 7
Project: ARKCraft   File: WorldGeneratorBushes.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	for (int i = 0; i < 25; i++)
	{
		int x = chunkX * 16 + random.nextInt(16);
		int z = chunkZ * 16 + random.nextInt(16);

		BlockPos pos = world.getHeight(new BlockPos(x, 0, z));

		if (world.getBlockState(pos).getBlock() instanceof BlockTallGrass)
		{
			world.setBlockState(pos, ARKCraftBlocks.berryBush.getDefaultState());
		}
	}
}
 
Example 8
Project: Placemod   File: Decorator.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random randomDefault, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!allowedDimensions.contains(world.provider.getDimension())) {
        return; // Dimension with given id is not allowed
    }
    Random random = getRandom(world.getSeed(), chunkX, chunkZ);
    int drops = (int) density + (random.nextDouble() <= (density - (int) density) ? 1 : 0);
    net.minecraft.world.biome.Biome biome = world.getBiomeGenForCoords(new BlockPos(chunkX * 16, 64, chunkZ * 16));
    Biome.Style biomeStyle = Biome.determine(biome);
    ArrayList<Cluster> biomeClusters = distributor.getClusters(biomeStyle);
    for (int i = 0; i < drops; ++i) {
        double pointer = random.nextDouble();
        for (Cluster cluster : biomeClusters) {
            if (pointer <= cluster.getChance()) {
                place(world, cluster, chunkX, chunkZ, random.nextLong());
                break;
            }
            pointer -= cluster.getChance();
        }
    }
}
 
Example 9
Project: Placemod   File: Decorator.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random randomDefault, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!allowedDimensions.contains(world.provider.getDimension())) {
        return; // Dimension with given id is not allowed
    }
    Random random = getRandom(world.getSeed(), chunkX, chunkZ);
    int drops = (int) density + (random.nextDouble() <= (density - (int) density) ? 1 : 0);
    net.minecraft.world.biome.Biome biome = world.getBiomeGenForCoords(new BlockPos(chunkX * 16, 64, chunkZ * 16));
    Biome.Style biomeStyle = Biome.determine(biome);
    ArrayList<Cluster> biomeClusters = distributor.getClusters(biomeStyle);
    for (int i = 0; i < drops; ++i) {
        double pointer = random.nextDouble();
        for (Cluster cluster : biomeClusters) {
            if (pointer <= cluster.getChance()) {
                place(world, cluster, chunkX, chunkZ, random.nextLong());
                break;
            }
            pointer -= cluster.getChance();
        }
    }
}
 
Example 10
Project: Placemod   File: Decorator.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random randomDefault, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!allowedDimensions.contains(world.provider.getDimension())) {
        return; // Dimension with given id is not allowed
    }
    Random random = getRandom(world.getSeed(), chunkX, chunkZ);
    int drops = (int) density + (random.nextDouble() <= (density - (int) density) ? 1 : 0);
    net.minecraft.world.biome.Biome biome = world.getBiomeGenForCoords(new BlockPos(chunkX * 16, 64, chunkZ * 16));
    Biome.Style biomeStyle = Biome.determine(biome);
    ArrayList<Cluster> biomeClusters = distributor.getClusters(biomeStyle);
    for (int i = 0; i < drops; ++i) {
        double pointer = random.nextDouble();
        for (Cluster cluster : biomeClusters) {
            if (pointer <= cluster.getChance()) {
                place(world, cluster, chunkX, chunkZ, random.nextLong());
                break;
            }
            pointer -= cluster.getChance();
        }
    }
}
 
Example 11
Project: Placemod   File: Decorator.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random randomDefault, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!allowedDimensions.contains(world.provider.getDimension())) {
        return; // Dimension with given id is not allowed
    }
    Random random = getRandom(world.getSeed(), chunkX, chunkZ);
    int drops = (int) density + (random.nextDouble() <= (density - (int) density) ? 1 : 0);
    BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(chunkX * 16, 64, chunkZ * 16));
    Biome.Style biomeStyle = Biome.determine(biome);
    ArrayList<Cluster> biomeClusters = distributor.getClusters(biomeStyle);
    for (int i = 0; i < drops; ++i) {
        double pointer = random.nextDouble();
        for (Cluster cluster : biomeClusters) {
            if (pointer <= cluster.getChance()) {
                place(world, cluster, chunkX, chunkZ, random.nextLong());
                break;
            }
            pointer -= cluster.getChance();
        }
    }
}
 
Example 12
Project: Lost-Eclipse-Outdated   File: LEWorldGenerator.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) 
{
	int blockX = chunkX * 16;
	int blockZ = chunkZ * 16;
	
	switch (world.provider.getDimension())
	{
		case -1: 
			generateNether(world, rand, blockX, blockZ);
			break;
		case 0: 
			generateOverworld(world, rand, blockX, blockZ);
			break;
		case 1: 
			generateEnd(world, rand, blockX, blockZ);
			break;
	}
}
 
Example 13
Project: Minecraft_Mineralogy   File: OreSpawner.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
					 IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

	random.setSeed(random.nextLong() ^ hash);
	random.nextInt();
	final float r = random.nextFloat();
	for(float f = frequency; f > r; f -= 1 ){
		int x = (chunkX << 4) + random.nextInt(16);
           int y = random.nextInt(maxY - minY) + minY;
           int z = (chunkZ << 4) + random.nextInt(16);
       //    System.out.println("Generating deposite of "+ore.getUnlocalizedName()+" at ("+x+","+y+","+z+")");
		BlockPos pos = new BlockPos(x,y,z);
		OreGenEvent oreEvent = new OreGenEvent(world,random,pos);
		net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(oreEvent);
		if(oreEvent.getResult() == Event.Result.DENY) {
			// canceled by other mod
			continue;
		}
		oreGen.generate(world, random, pos);
	}
}
 
Example 14
Project: CherryPig   File: CPTreeWorldGen.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    int xSpawn, ySpawn, zSpawn;
    int xPos = chunkX * 16 + 8, zPos = chunkZ * 16 + 8;

    String biomeName = world.getBiomeForCoordsBody(new BlockPos(xPos, 64, zPos)).getBiomeName();;

    if (biomeName == null) {
        return;
    }
    if (biomeName == "Forest" || biomeName == "AutumnWoods" || biomeName == "BirchForest" || biomeName == "PineForest" || biomeName == "Rainforest" || biomeName == "TemperateRainforest"
            || biomeName == "Woodlands" || biomeName == "Plains")
    {

            for (int iter = 0; iter < 3; iter++)
            {
                xSpawn = xPos + random.nextInt(16);
                ySpawn = random.nextInt(300) + 64;
                zSpawn = zPos + random.nextInt(16);
                genCherryTree.generate(world, random, new BlockPos(xSpawn, ySpawn, zSpawn));
            }


    }
}
 
Example 15
Project: TurtleMod   File: TutorialWorldGenerator.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
    case 0: //Overworld
    	// this.runGenerator(this.gen_tutorial_ore, world, random, chunkX, chunkZ, 20, 0, 64);
        break;
    case -1: //Nether

        break;
    case 1: //End

        break;
    }
    
	
}
 
Example 16
Project: rezolve   File: CityGenerator.java   Source Code and License 5 votes vote down vote up
private void generateBuilding(
	Random rand, int chunkX, int groundY, int chunkZ, int chunkSize, int towerFloors, 
	World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) 
{

	this.prepareSpace(world, chunkX, groundY, chunkZ, chunkSize, Blocks.AIR.getDefaultState());
	this.drawStandardRoads(world, chunkX, groundY, chunkZ, chunkSize);
	this.drawStandardSidewalks(world, chunkX, groundY, chunkZ, chunkSize);

	// Draw the tower	
	this.generateTower(rand, world, chunkX * 16 + 4, groundY + 1, chunkZ * 16 + 4, chunkSize - 8, chunkSize - 8, towerFloors);
	
}
 
Example 17
Project: Firma   File: FirmaTree.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	//System.out.println("Generating "+bs+" at "+chunkX+", "+chunkZ);
	int x = random.nextInt(16);
	int z = random.nextInt(16);
	BlockPos pos = new BlockPos((chunkX*16)+x,0,(chunkZ*16)+z);
	pos = world.getTopSolidOrLiquidBlock(pos);
	//pos = pos.up();
	generate(world, random, pos);
}
 
Example 18
Project: Firma   File: FirmaTreeGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	byte b = world.getChunkFromChunkCoords(chunkX, chunkZ).getBiomeArray()[0];
	FirmaTree[] tl = FirmaBiome.getTreeForBiome(b, chunkZ*16);
	if(tl.length==0){ return; }
	FirmaTree ft = tl[random.nextInt(tl.length)];
	FirmaBiome bi = (FirmaBiome) Biome.getBiome(b);
	for(int i = 0; i < bi.treeCount; i++){
		ft.generate(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
	}
}
 
Example 19
Project: Firma   File: FirmaOreGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	count = 0;
	for (OresEnum ore : OresEnum.values()) {
		for (int i = 0; i < 3; i++) {
			if (random.nextInt(100) < ore.getRarity()) {
				new FirmaMinable(ore, random.nextInt(ore.getRarity() / 2) + ore.getRarity(), random.nextInt(5)).generate(world, random, chunkX, chunkZ);
			}
		}
	}
	// System.out.println(count+" ores added to this chunk");
}
 
Example 20
Project: Firma   File: ShitOnFloorGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	for (int i = 0; i < random.nextInt(16); i++) {
		belowTree = false;
		int x = random.nextInt(16) + chunkX * 16;
		int z = random.nextInt(16) + chunkZ * 16;
		int y = world.getHeight();
		BlockPos pos = new BlockPos(x,y,z);
		while(!shitCheck(world, pos)) {
			pos = pos.down();
		}
		IBlockState b = world.getBlockState(pos);
		if (Util.isClay(b.getBlock()) || Util.isDirt(b.getBlock()) || Util.isGrass(b.getBlock()) || Util.isRawStone(b.getBlock())
				|| Util.isSand(b.getBlock()) || Util.isGravel(b.getBlock()) && b.getBlock() instanceof BaseBlock) { // Sensible
																													// locations
																													// for
																													// shit
			BaseBlock bb = (BaseBlock) b.getBlock();
			String meta = bb.getMetaName(b.getBlock().getMetaFromState(b));
			pos = pos.up();
			world.setBlockState(pos, FirmaMod.shitOnFloor.getDefaultState(), 2);
			SoFTileEntity te = (SoFTileEntity) world.getTileEntity(pos);
			if (te != null) {
				te.setItem(getItemForArea(random,meta));
				te.markDirty();
			}
		}
	}
}
 
Example 21
Project: MagicWinds   File: ModWorldGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()){
        case -1:
            break;
        case 0:
            this.runGenerator(this.gen_green_shard_ore, world, random, chunkX, chunkZ, 20,0, 60);
            break;
        case 1:
            break;
    }
}
 
Example 22
Project: CustomWorldGen   File: ChunkGeneratorEvent.java   Source Code and License 5 votes vote down vote up
public ReplaceBiomeBlocks(IChunkGenerator chunkProvider, int x, int z, ChunkPrimer primer, World world)
{
    super(chunkProvider);
    this.x = x;
    this.z = z;
    this.primer = primer;
    this.world = world;
}
 
Example 23
Project: CustomWorldGen   File: ChunkGeneratorEvent.java   Source Code and License 5 votes vote down vote up
public InitNoiseField(IChunkGenerator chunkProvider, double[] noisefield, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ)
{
    super(chunkProvider);
    this.setNoisefield(noisefield);
    this.posX = posX;
    this.posY = posY;
    this.posZ = posZ;
    this.sizeX = sizeX;
    this.sizeY = sizeY;
    this.sizeZ = sizeZ;
}
 
Example 24
Project: CustomWorldGen   File: PopulateChunkEvent.java   Source Code and License 5 votes vote down vote up
public PopulateChunkEvent(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated)
{
    super(gen);
    this.world = world;
    this.rand = rand;
    this.chunkX = chunkX;
    this.chunkZ = chunkZ;
    this.hasVillageGenerated = hasVillageGenerated;
}
 
Example 25
Project: LittleThings-old   File: EmeraldsEverywhere.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    for (int i = 0; i < clusterCount; i++) {
        int x = chunkX * 16 + random.nextInt(16);
        int y = random.nextInt(16);
        int z = chunkZ * 16 + random.nextInt(16);

        generator.generate(world, random, new BlockPos(x, y, z));
    }
}
 
Example 26
Project: CrystalMod   File: CrystalModWorldGenerator.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    for(IGenerationFeature feature : featureList){
    	if (feature.generateFeature(world, random, chunkX, chunkZ, true)) {
            world.getChunkFromChunkCoords(chunkX, chunkZ).setChunkModified();
        }
    }
    boolean genSpikes = false;
    if(world.provider.getDimension() == 0 && genSpikes){
    	crystexiumSpikeGen.generate(world, chunkX, chunkZ, null);
    	crystexiumSpikeGen.generateStructure(world, random, new ChunkPos(chunkX, chunkZ));
    }        
}
 
Example 27
Project: TechnicalDimensions   File: CustomChunkProvider.java   Source Code and License 5 votes vote down vote up
public static IChunkGenerator getGenForWorld(DimData data, World worldIn, long seed, boolean mapFeaturesEnabledIn, String settings) {
    if (data.falt) {
        return new ChunkProviderFlat(worldIn, seed, mapFeaturesEnabledIn, "3;minecraft:bedrock,60*minecraft:stone,2*minecraft:dirt,minecraft:grass;3;village(size=50 distance=50),mineshaft(chance=0.5),biome_1,dungeon,decoration,lake,lava_lake");
    }
    //TODO get custom shit
    return new ChunkProviderOverworld(worldIn, seed, mapFeaturesEnabledIn, settings);
}
 
Example 28
Project: InspiringWorld   File: WorldGenRemains.java   Source Code and License 5 votes vote down vote up
private void generatePool(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider) {
    //if(chunkX%(1000/16) != 0|| chunkZ%(1000/16) != 0) return;
    if(random.nextInt(1000)>100) return;
    int x = chunkX*16 + random.nextInt(16);
    int z = chunkZ*16 + random.nextInt(16);
    int y = world.getPrecipitationHeight(new BlockPos(x,0,z)).getY();
    for(int i=0; i<22; i++) {
        for(int j=0; j<22; j++) {
            world.setBlockState(new BlockPos(x+i,y,z+j), Blocks.CLAY.getDefaultState());
        }
    }
}
 
Example 29
Project: InspiringWorld   File: EnderSpiderSpawnerGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
    IChunkProvider chunkProvider) {
    for (TileEntity tileEntity : world.getChunkFromChunkCoords(chunkX, chunkZ).getTileEntityMap().values()) {
        if (tileEntity instanceof TileEntityMobSpawner) {
            MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner) tileEntity).getSpawnerBaseLogic();
            if ("CaveSpider".equals(spawner.getEntityNameToSpawn()) && random.nextInt(4) == 0) {
                spawner.setEntityName("EnderSpider");
            }
        }
    }
}
 
Example 30
Project: Naschkatze   File: WorldGenNkOre.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

    switch (world.provider.getDimension()) {

        case -1:
            break;
        case 0:
            runGenerator(this.oreGen, world, random, chunkX, chunkZ, veinsPerChunk, minHeight, maxHeight);
            break;
        case 1:
            break;
    }
}
 
Example 31
Project: geomastery   File: WorldGenerator.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random rand, int chunkScaleX, int chunkScaleZ,
        World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider) {

    if (world.provider.getDimension() == 0) {

        if (!(chunkGenerator instanceof ChunkProviderFlat)) {
            
            generateOverworldChunk(world, rand, chunkScaleX * 16,
                chunkScaleZ * 16);
        }
    }
}
 
Example 32
Project: TFICore   File: GenWorldVeins.java   Source Code and License 5 votes vote down vote up
@Override
@SubscribeEvent
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimensionType()) {
        case OVERWORLD:
            generateOverworld(world, random, chunkX, chunkZ);
            break;
        case NETHER:
            generateNether(world, random, chunkX, chunkZ);
            break;
        case THE_END:
            generateEnd(world, random, chunkX, chunkZ);
            break;
    }
}
 
Example 33
Project: TeslaEssentials   File: ModWorldGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
        case 0: //Overworld
            if(this.c)
                runGenerator(gen_oreCopper, world, random, chunkX, chunkZ, 9, 20, 64);
            if(this.t)
                runGenerator(gen_oreTin, world, random, chunkX, chunkZ, 9, 20, 64);
            if(this.l)
                runGenerator(gen_oreLead, world, random, chunkX, chunkZ, 4, 0, 40);
            break;
        case -1: /*Nether*/ break;
        case 1: /*End*/ break;
    }
}
 
Example 34
Project: ARKCraft   File: WrappedOreGenerator.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	for (Instruction var : this.generations.values())
	{
		int var1 = world.provider.getDimension();
		if (var1 == -1)
		{
			if (var.nether)
			{
				generateInNether(var, world, random, chunkX * 16, chunkZ * 16);
			}
		}
		else if (var1 == 0)
		{
			if (var.overworld)
			{
				generateInOverworld(var, world, random, chunkX * 16, chunkZ * 16);
			}
		}
		else if (var1 == 1)
		{
			if (var.end)
			{
				generateInEnd(var, world, random, chunkX * 16, chunkZ * 16);
			}
		}
		else
		{
			for (int v : var.getDimensions())
			{
				if (var1 == v)
				{
					this.generateInDimension(var, world, random, chunkX * 16, chunkZ * 16);
				}
			}
		}
	}
}
 
Example 35
Project: TombCraft   File: WorldGeneratorTombCraft.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
        case 0: GenerateOverworld(random, chunkX * 16, chunkZ * 16, world); break;
        case 1: GenerateEnd(random, chunkX * 16, chunkZ * 16, world); break;
        case -1: GenerateNether(random, chunkX * 16, chunkZ * 16, world); break;
    }
}
 
Example 36
Project: Alloycraft   File: UtilsWorldgen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
        case 0: oregenOverworld(random, chunkX * 16, chunkZ * 16, world); break;
        case 1: oregenEnd(random, chunkX * 16, chunkZ * 16, world); break;
        case -1: oregenNether(random, chunkX * 16, chunkZ * 16, world); break;
    }
}
 
Example 37
Project: TFC2   File: WorldGenTFC.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGen,IChunkProvider chunkProvider)
{
	chunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
	chunkX *= 16;
	chunkZ *= 16;

	map = Core.getMapForWorld(world, new BlockPos(chunkX, 0, chunkZ));
	iMoisture = map.getParams().getIslandMoisture();
}
 
Example 38
Project: NordMod   File: NordOre.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

    switch (world.provider.getDimension()) {
        case -1:
            generateAllNetherOre(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 0:
            generateAllOverworldOre(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            generateAllEndOre(world, random, chunkX * 16, chunkZ * 16);
            break;
    }
}
 
Example 39
Project: KalStuff   File: WorldGenMoonFlower.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	if (random.nextInt(200) == 1) {
		ArrayList<BlockPos> somePos = this.getValidLocationsInArea(random, chunkX * 16 + random.nextInt(16), chunkZ * 16 + random.nextInt(16), 8, world);
		
		if (somePos != null) {
			for (int i = 0; i < somePos.size(); i ++)
				if (somePos.get(i) != null)
					world.setBlockState(somePos.get(i).up(), KalStuffBlocks.moon_flower.getDefaultState());
		}
	}
}
 
Example 40
Project: KalStuff   File: WorldGenGrapeVine.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	BlockPos aPos = this.getSurface(chunkX * 16 + random.nextInt(16), chunkZ * 16 + random.nextInt(16), world);
	if (random.nextInt(10) == 1) {
		if (aPos != null && world.getBiomeForCoordsBody(aPos) == Biome.REGISTRY.getObject(new ResourceLocation("roofed_forest"))) {
			world.setBlockState(aPos.up(), KalStuffBlocks.wild_grape_vine.getDefaultState());
		}
	}
}
 
Example 41
Project: Wars-Mod   File: WarsWorldGenerator.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

	switch (world.provider.getDimension()) {
	case 0:
		generateSurface(world, random, chunkX * 16, chunkZ * 16);
	default:
		break;
	}
}
 
Example 42
Project: wise-plus-mod   File: ModWorldGenerator.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator iChunkGenerator, IChunkProvider iChunkProvider) {
    switch (world.provider.getDimensionType()) {
        case OVERWORLD:
            runGenerator(this.titaniumOreGenerator, world, random, chunkX, chunkZ, 2, 40, 50);
            break;
        case NETHER:
            break;
        case THE_END:
            break;
    }
}
 
Example 43
Project: simpleretrogen   File: WorldRetrogen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    FMLLog.fine("Passing generation for %s through to underlying generator", tag);
    delegate.generate(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    ChunkPos chunkCoordIntPair = new ChunkPos(chunkX, chunkZ);
    completeRetrogen(chunkCoordIntPair, world, tag);
}
 
Example 44
Project: simpleretrogen   File: WorldRetrogen.java   Source Code and License 5 votes vote down vote up
private void runRetrogen(WorldServer world, ChunkPos chunkCoords, String retroClass)
{
    long worldSeed = world.getSeed();
    Random fmlRandom = new Random(worldSeed);
    long xSeed = fmlRandom.nextLong() >> 2 + 1L;
    long zSeed = fmlRandom.nextLong() >> 2 + 1L;
    long chunkSeed = (xSeed * chunkCoords.chunkXPos + zSeed * chunkCoords.chunkZPos) ^ worldSeed;

    fmlRandom.setSeed(chunkSeed);
    ChunkProviderServer providerServer = world.getChunkProvider();
    IChunkGenerator generator = ObfuscationReflectionHelper.getPrivateValue(ChunkProviderServer.class, providerServer, "field_186029_c", "chunkGenerator");
    delegates.get(retroClass).delegate.generate(fmlRandom, chunkCoords.chunkXPos, chunkCoords.chunkZPos, world, generator, providerServer);
    FMLLog.fine("Retrogenerated chunk for %s", retroClass);
    completeRetrogen(chunkCoords, world, retroClass);
}
 
Example 45
Project: simpleretrogen   File: TestGenerator.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void preinit(FMLPreInitializationEvent init)
{
    final Logger modLog = init.getModLog();
    IWorldGenerator gen = new IWorldGenerator() {
        @Override
        public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
        {
            modLog.log(Level.INFO, "Calling!");
        }
    };
    GameRegistry.registerWorldGenerator(gen, 10);
}
 
Example 46
Project: taam   File: OreGenerator.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	switch (world.provider.getDimension()) {
	case -1:
		generateNether(world, random, chunkX * 16, chunkZ * 16);
		break;
	default:
	case 0:
		generateSurface(world, random, chunkX * 16, chunkZ * 16);
		break;
	case 1:
		generateEnd(world, random, chunkX * 16, chunkZ * 16);
		break;
	}
}
 
Example 47
Project: Minecraft_Mineralogy   File: StoneReplacer.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
					 IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	if(world.provider.getDimension() == 0){
		getGeology(world).replaceStoneInChunk(chunkX, chunkZ, world);
	}
}
 
Example 48
Project: TFC2   File: WorldGenTFC.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGen,IChunkProvider chunkProvider)
{
	chunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
	chunkX *= 16;
	chunkZ *= 16;

	map = Core.getMapForWorld(world, new BlockPos(chunkX, 0, chunkZ));
	iMoisture = map.getParams().getIslandMoisture();
}
 
Example 49
Project: Extra-Food   File: PeanutWorldGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
    switch(world.provider.getDimension()){
        case -1: generateNether(world, random, chunkX * 16, chunkZ * 16);
        case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16);
        case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16);
    }


}
 
Example 50
Project: Extra-Food   File: StrawberryWorldGen.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch(world.provider.getDimension()){
        case -1: generateNether(world, random, chunkX * 16, chunkZ * 16);
        case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16);
        case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16);
    }


}
 
Example 51
Project: Extra-Food   File: TreeManager.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.getDimension()) {
        case -1:
            generateNether(world, random, chunkX * 16, chunkZ * 16);
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
        case 1:
            generateEnd(world, random, chunkX * 16, chunkZ * 16);
    }

}
 
Example 52
Project: PowerOfMagic   File: WorldGenMoleculer.java   Source Code and License 5 votes vote down vote up
@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	switch(world.provider.getDimension()){
		case -1:
			generateNether(world, rand, chunkX * 16, chunkZ * 16);
		case 0:
			generateSurface(world, rand, chunkX * 16, chunkZ * 16);
	}
}
 
Example 53
Project: earthcraft   File: EarthWorld.java   Source Code and License 5 votes vote down vote up
@Override
public IChunkGenerator getChunkGenerator(World world,
		String settingsJson) {
	EarthcraftMod plugin = null;
	MapProjection mapProjection = new EquirectangularProjection();
	ElevationProjection elevProjection = new LinearElevationProjection();
	ElevationProvider elevation = new TestElevationProvider();
	CoordBiomeProvider biome = new DefaultBiomeProvider();
	Coordinate spawn = new Coordinate(0,0);
	EarthChunkProvider chunkGen = new EarthChunkProvider(plugin, world,
			world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(),
			settingsJson, mapProjection, elevProjection , elevation , biome , spawn );
	//return super.getChunkGenerator(world, generatorOptions);
	return chunkGen;
}
 
Example 54
Project: Firma   File: FirmaWorld.java   Source Code and License 4 votes vote down vote up
@Override
public IChunkGenerator getChunkGenerator(World world, String generatorOptions) {
	return new FirmaChunkGen(world, true);
}
 
Example 55
Project: JustJunk   File: ModWorldGeneration.java   Source Code and License 4 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (world.provider.getDimension() == 0) { // the overworld
        generateOverworld(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    }
}
 
Example 56
Project: JustJunk   File: ModWorldGeneration.java   Source Code and License 4 votes vote down vote up
private void generateOverworld(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    generateOre(ModBlocks.tinore.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 16, 64, 4 + random.nextInt(4), 6);
    generateOre(ModBlocks.copperore.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 16, 64, 4 + random.nextInt(4), 6);
    generateOre(ModBlocks.pyriteore.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 16, 64, 4 + random.nextInt(4), 6);
}
 
Example 57
Project: MC-More-Ore-Mod   File: OreGenerator.java   Source Code and License 4 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	
	switch(world.provider.getDimension()) {
	
	case -1:
		
		generateNether(world, random, chunkX, chunkZ);
		break;
		
	case 0:
		
		generateOverworld(world, random, chunkX, chunkZ);
		break;
		
	case 1:
		
		generateEnd(world, random, chunkX, chunkZ);
		break;
	
	}
	
}
 
Example 58
Project: Zombe-Modpack   File: WorldProvider.java   Source Code and License 4 votes vote down vote up
public IChunkGenerator createChunkGenerator()
{
    return (IChunkGenerator)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
 
Example 59
Project: Backmemed   File: WorldProvider.java   Source Code and License 4 votes vote down vote up
public IChunkGenerator createChunkGenerator()
{
    return (IChunkGenerator)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))));
}
 
Example 60
Project: Backmemed   File: WorldProviderEnd.java   Source Code and License 4 votes vote down vote up
public IChunkGenerator createChunkGenerator()
{
    return new ChunkProviderEnd(this.worldObj, this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.worldObj.getSeed(), this.getSpawnCoordinate());
}