当前位置: 首页>>代码示例>>Java>>正文


Java IWorldGenerator类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.IWorldGenerator的典型用法代码示例。如果您正苦于以下问题:Java IWorldGenerator类的具体用法?Java IWorldGenerator怎么用?Java IWorldGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IWorldGenerator类属于net.minecraftforge.fml.common包,在下文中一共展示了IWorldGenerator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateWorld

import net.minecraftforge.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         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: doRetrogen

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
void doRetrogen(boolean test, Chunk chunk, String genType, IWorldGenerator gen) {
    if (!test) return;
    final int chunkX = chunk.xPosition, chunkZ = chunk.zPosition;
    final World world = chunk.getWorld();
    //log("Retrogenning %s in dimension %s at chunk coordinates (%s, %s)", genType, world.provider.getDimensionId(), chunkX, chunkZ);
    
    //Thanks, FML!
    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;
    fmlRandom.setSeed(chunkSeed);
    
    final IChunkProvider chunkProvider = world.getChunkProvider();
    gen.generate(fmlRandom, chunkX, chunkZ, world, chunkProvider, chunkProvider);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:18,代码来源:WorldgenManager.java

示例3: process

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
@Override
public void process(ITypesetter out, String arg) throws TruthError {
    try {
        GameRegistry.generateWorld(0, 0, null, null, null);
    } catch (NullPointerException e) {
        // lazy way of making the sortedGeneratorList not be null. Swallow the exception whole.
    }
    List<IWorldGenerator> sortedGeneratorList = ReflectionHelper.getPrivateValue(GameRegistry.class, null, "sortedGeneratorList");
    out.write("\\title{Sorted World Generators}\n\n");
    if (sortedGeneratorList == null) {
        out.write("Failed to load generator list!");
        return;
    }

    for (IWorldGenerator gen : sortedGeneratorList) {
        out.write(gen.toString() + "\n\n");
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:19,代码来源:WorldgenViewer.java

示例4: serverStopped

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
@EventHandler
public void serverStopped(FMLServerStoppedEvent evt)
{
    Set<IWorldGenerator> worldGens = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGenerators");
    Map<IWorldGenerator,Integer> worldGenIdx = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGeneratorIndex");

    for (TargetWorldWrapper tww : delegates.values())
    {
        worldGens.remove(tww);
        Integer idx = worldGenIdx.remove(tww);
        worldGens.add(tww.delegate);
        worldGenIdx.put(tww.delegate,idx);
    }

    delegates.clear();
}
 
开发者ID:cpw,项目名称:simpleretrogen,代码行数:17,代码来源:WorldRetrogen.java

示例5: registerWorldGenerator

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
/**
 * Register a world generator - something that inserts new block types into the world
 *
 * @param generator           the generator
 * @param modGenerationWeight a weight to assign to this generator. Heavy weights tend to sink to the bottom of
 *                            list of world generators (i.e. they run later)
 */
public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight)
{
    worldGenerators.add(generator);
    worldGeneratorIndex.put(generator, modGenerationWeight);
    if (sortedGeneratorList != null)
    {
        sortedGeneratorList = null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:GameRegistry.java

示例6: computeSortedGeneratorList

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
private static void computeSortedGeneratorList()
{
    ArrayList<IWorldGenerator> list = Lists.newArrayList(worldGenerators);
    Collections.sort(list, new Comparator<IWorldGenerator>()
    {
        @Override
        public int compare(IWorldGenerator o1, IWorldGenerator o2)
        {
            return Ints.compare(worldGeneratorIndex.get(o1), worldGeneratorIndex.get(o2));
        }
    });
    sortedGeneratorList = ImmutableList.copyOf(list);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:GameRegistry.java

示例7: preinit

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
@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);
}
 
开发者ID:cpw,项目名称:simpleretrogen,代码行数:14,代码来源:TestGenerator.java

示例8: registerWorldGenerator

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight) {
	GameRegistry.registerWorldGenerator(generator, modGenerationWeight);
}
 
开发者ID:HyCraftHD,项目名称:TeambattleMod,代码行数:4,代码来源:CommonRegistryUtil.java

示例9: register

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
private static void register(IWorldGenerator generator)
{
	register(generator, 0);
}
 
开发者ID:BubbleTrouble14,项目名称:ARKCraft,代码行数:5,代码来源:ARKCraftWorldGen.java

示例10: serverAboutToStart

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
@EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent evt)
{
    this.pendingWork = new MapMaker().weakKeys().makeMap();
    this.completedWork = new MapMaker().weakKeys().makeMap();
    this.completedWorkLocks = new MapMaker().weakKeys().makeMap();

    Set<IWorldGenerator> worldGens = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGenerators");
    Map<IWorldGenerator,Integer> worldGenIdx = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGeneratorIndex");

    for (String retro : ImmutableSet.copyOf(retros.keySet()))
    {
        if (!delegates.containsKey(retro))
        {
            FMLLog.info("Substituting worldgenerator %s with delegate", retro);
            for (Iterator<IWorldGenerator> iterator = worldGens.iterator(); iterator.hasNext();)
            {
                IWorldGenerator wg = iterator.next();
                if (wg.getClass().getName().equals(retro))
                {
                    iterator.remove();
                    TargetWorldWrapper tww = new TargetWorldWrapper();
                    tww.delegate = wg;
                    tww.tag = retro;
                    worldGens.add(tww);
                    Integer idx = worldGenIdx.remove(wg);
                    worldGenIdx.put(tww, idx);
                    FMLLog.info("Successfully substituted %s with delegate", retro);
                    delegates.put(retro, tww);
                    break;
                }
            }

            if (!delegates.containsKey(retro))
            {
                FMLLog.warning("WorldRetrogen was not able to locate world generator class %s, it will be skipped, found %s", retro, worldGens);
                retros.remove(retro);
            }
        }
    }
}
 
开发者ID:cpw,项目名称:simpleretrogen,代码行数:42,代码来源:WorldRetrogen.java

示例11: addWorldGenerator

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
public static void addWorldGenerator(IWorldGenerator generator, int modGenerationWeight) {
	GameRegistry.registerWorldGenerator(generator, modGenerationWeight);
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:4,代码来源:Registers.java

示例12: registerWorldGen

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
public static void registerWorldGen(IWorldGenerator worldGenClass, int weightedProbability){
	GameRegistry.registerWorldGenerator(worldGenClass, weightedProbability);
}
 
开发者ID:MoreThanHidden,项目名称:PowerOfMagic,代码行数:4,代码来源:MolecularWorld.java

示例13: registerWorldGenerator

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
/**
 * Register an {@link IWorldGenerator}
 * 
 * @param generator
 *            Instance of implemention of IWorldgenerator
 * @param modGenerationWeight
 *            Worldgeneration order
 */
public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight) {
	GameRegistry.registerWorldGenerator(generator, modGenerationWeight);
}
 
开发者ID:HyCraftHD,项目名称:ModLibary,代码行数:12,代码来源:GenerationRegistry.java

示例14: registerWorldGen

import net.minecraftforge.fml.common.IWorldGenerator; //导入依赖的package包/类
public static void registerWorldGen(IWorldGenerator generator, int modGenerationWeight) {

        GameRegistry.registerWorldGenerator(generator, modGenerationWeight);
    }
 
开发者ID:secknv,项目名称:Naschkatze,代码行数:5,代码来源:NkWorldGens.java


注:本文中的net.minecraftforge.fml.common.IWorldGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。