當前位置: 首頁>>代碼示例>>Java>>正文


Java IChunkGenerator類代碼示例

本文整理匯總了Java中net.minecraft.world.chunk.IChunkGenerator的典型用法代碼示例。如果您正苦於以下問題:Java IChunkGenerator類的具體用法?Java IChunkGenerator怎麽用?Java IChunkGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IChunkGenerator類屬於net.minecraft.world.chunk包,在下文中一共展示了IChunkGenerator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateWorld

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:29,代碼來源:GameRegistry.java

示例2: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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;
        }
    }
}
 
開發者ID:droidicus,項目名稱:AquaRegia,代碼行數:25,代碼來源:WorldGenOres.java

示例3: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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;
    }
}
 
開發者ID:TeamFRM,項目名稱:TAIGA,代碼行數:21,代碼來源:WorldGen.java

示例4: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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;
	}

}
 
開發者ID:KillBait,項目名稱:PrimordialCrops,代碼行數:20,代碼來源:MagicalWorldGen.java

示例5: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:MinecraftModDevelopmentMods,項目名稱:HempFarmer,代碼行數:19,代碼來源:HempGen.java

示例6: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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;
                }
    }
}
 
開發者ID:alxnns1,項目名稱:MobHunter,代碼行數:25,代碼來源:WorldGenHandler.java

示例7: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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());
		}
	}
}
 
開發者ID:BubbleTrouble14,項目名稱:ARKCraft,代碼行數:17,代碼來源:WorldGeneratorBushes.java

示例8: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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();
        }
    }
}
 
開發者ID:ternsip,項目名稱:Placemod,代碼行數:22,代碼來源:Decorator.java

示例9: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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();
        }
    }
}
 
開發者ID:ternsip,項目名稱:Placemod,代碼行數:22,代碼來源:Decorator.java

示例10: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:TheXFactor117,項目名稱:Lost-Eclipse-Outdated,代碼行數:20,代碼來源:LEWorldGenerator.java

示例11: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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);
	}
}
 
開發者ID:cyanobacterium,項目名稱:Minecraft_Mineralogy,代碼行數:23,代碼來源:OreSpawner.java

示例12: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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));
            }


    }
}
 
開發者ID:Othlon,項目名稱:CherryPig,代碼行數:27,代碼來源:CPTreeWorldGen.java

示例13: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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;
    }
    
	
}
 
開發者ID:ProBossGamers,項目名稱:TurtleMod,代碼行數:18,代碼來源:TutorialWorldGenerator.java

示例14: generateBuilding

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
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);
	
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:14,代碼來源:CityGenerator.java

示例15: generate

import net.minecraft.world.chunk.IChunkGenerator; //導入依賴的package包/類
@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);
}
 
開發者ID:trigg,項目名稱:Firma,代碼行數:11,代碼來源:FirmaTree.java


注:本文中的net.minecraft.world.chunk.IChunkGenerator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。