当前位置: 首页>>代码示例>>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;未经允许,请勿转载。