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


Java IWorldGenerator.generate方法代碼示例

本文整理匯總了Java中cpw.mods.fml.common.IWorldGenerator.generate方法的典型用法代碼示例。如果您正苦於以下問題:Java IWorldGenerator.generate方法的具體用法?Java IWorldGenerator.generate怎麽用?Java IWorldGenerator.generate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cpw.mods.fml.common.IWorldGenerator的用法示例。


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

示例1: generateWorld

import cpw.mods.fml.common.IWorldGenerator; //導入方法依賴的package包/類
/**
 * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
 * call this
 *
 * @param chunkX
 * @param chunkZ
 * @param world
 * @param chunkGenerator
 * @param chunkProvider
 */
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
    if (sortedGeneratorList == null)
    {
        computeSortedGeneratorList();
    }
    long worldSeed = world.func_72905_C();
    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:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:29,代碼來源:GameRegistry.java

示例2: generateWorld

import cpw.mods.fml.common.IWorldGenerator; //導入方法依賴的package包/類
/**
 * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
 * call this
 *
 * @param chunkX
 * @param chunkZ
 * @param world
 * @param chunkGenerator
 * @param chunkProvider
 */
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider 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:alexandrage,項目名稱:CauldronGit,代碼行數:29,代碼來源:GameRegistry.java

示例3: isEnabled

import cpw.mods.fml.common.IWorldGenerator; //導入方法依賴的package包/類
public static boolean isEnabled(IWorldGenerator generator)
{
	if(isEnabled(generator))
	{
		long worldSeed = 0;
        Random fmlRandom = new Random(worldSeed);
        long xSeed = fmlRandom.nextLong() >> 2 + 1L;
        long zSeed = fmlRandom.nextLong() >> 2 + 1L;
        int chunkX = 0;
		int chunkZ = 0;
		long chunkSeed = (xSeed * chunkX  + zSeed * chunkZ ) ^ worldSeed;
		fmlRandom.setSeed(chunkSeed);
		World world = null;
		IChunkProvider chunkGenerator = null;
		IChunkProvider chunkProvider = null;
		generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
	}
	return false;
}
 
開發者ID:CreativeMD,項目名稱:World-Generation-Manager,代碼行數:20,代碼來源:GenerationDummyContainer.java

示例4: generateWorld

import cpw.mods.fml.common.IWorldGenerator; //導入方法依賴的package包/類
/**
 * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
 * call this
 *
 * @param chunkX
 * @param chunkZ
 * @param world
 * @param chunkGenerator
 * @param chunkProvider
 */
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider 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;

    boolean before = ((net.minecraft.world.WorldServer)world).theChunkProviderServer.loadChunkOnProvideRequest; // Cauldron store value
    ((net.minecraft.world.WorldServer)world).theChunkProviderServer.loadChunkOnProvideRequest = true; // Cauldron load chunks on provide requests
    for (IWorldGenerator generator : worldGenerators)
    {
    // Cauldron start
        if (!configWorldGenCache.containsKey(generator.getClass().getName()))
        {
            String modId = worldGenMap.get(generator.getClass().getName());
            String generatorName = "";
            generatorName = modId + "-" + generator.getClass().getSimpleName();
            boolean generatorEnabled = world.cauldronConfig.getBoolean("worldgen-" + generatorName, true);
            configWorldGenCache.put(generator.getClass().getName(), generatorEnabled);
        }
        if (configWorldGenCache.get(generator.getClass().getName()))
        {
            fmlRandom.setSeed(chunkSeed);
            generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
        }
    }
    ((net.minecraft.world.WorldServer)world).theChunkProviderServer.loadChunkOnProvideRequest = before; // reset
    // Cauldron end
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:45,代碼來源:GameRegistry.java

示例5: generateWorld

import cpw.mods.fml.common.IWorldGenerator; //導入方法依賴的package包/類
/**
 * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
 * call this
 *
 * @param chunkX
 * @param chunkZ
 * @param world
 * @param chunkGenerator
 * @param chunkProvider
 */
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
    long worldSeed = world.func_72905_C();
    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 : worldGenerators)
    {
        fmlRandom.setSeed(chunkSeed);
        generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:25,代碼來源:GameRegistry.java

示例6: generateWorld

import cpw.mods.fml.common.IWorldGenerator; //導入方法依賴的package包/類
/**
 * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
 * call this
 *
 * @param chunkX
 * @param chunkZ
 * @param world
 * @param chunkGenerator
 * @param chunkProvider
 */
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
    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 : worldGenerators)
    {
        fmlRandom.setSeed(chunkSeed);
        generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:25,代碼來源:GameRegistry.java


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