Java 类cpw.mods.fml.common.IWorldGenerator 实例源码

项目:TRHS_Club_Mod_2016    文件:GameRegistry.java   
/**
 * 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);
    }
}
项目:CauldronGit    文件:GameRegistry.java   
/**
 * 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);
    }
}
项目:Cauldron    文件:GameRegistry.java   
/**
 * 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);
    }
}
项目:Cauldron    文件:GameRegistry.java   
/**
 * 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)
{
    // Cauldron start - mod id's are not available during generateWorld so we must capture them here
    String modId = Loader.instance().activeModContainer().getModId();
    modId = modId.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric
    modId.replace(" ", "_");
    worldGenerators.add(generator);
    worldGeneratorIndex.put(generator, modGenerationWeight);
    if (sortedGeneratorList != null)
    {
        sortedGeneratorList = null;
    }
    worldGenMap.put(generator.getClass().getName(), modId);
    // Cauldron end
}
项目:Cauldron    文件:GameRegistry.java   
/**
 * 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);
    }
}
项目:World-Generation-Manager    文件:GenerationDummyContainer.java   
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;
}
项目:World-Generation-Manager    文件:GenerationDummyContainer.java   
public static String getName(IWorldGenerator generator)
{
    try
    {
        String name = (String) generator.getClass().getMethod("getName").invoke(generator);
        if(!name.equals(""))
            return name;
    }catch(Exception e){

    }
    if(!getPrefix().equals("minecraft"))
    {
        return getPrefix();
    }
    return generator.getClass().getName();
}
项目:World-Generation-Manager    文件:GenerationDummyContainer.java   
public static void onAdd(IWorldGenerator generator)
{
    try
    {
        String name = getName(generator);
        while (containsName(name)) {
            name += "I";
        }
        WorldGenerator worldGenerator = new WorldGenerator(name, generator, getPrefix());
        worldGenerators.add(worldGenerator);
        configuration.load();
        worldGenerator.state = configuration.get("regeneration", worldGenerator.name, 1).getInt();
        configuration.save();
    }catch(Exception e){
        System.out.println("Error registering World Generator");
        e.printStackTrace();
    }
}
项目:TRHS_Club_Mod_2016    文件:GameRegistry.java   
/**
 * 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;
    }
}
项目:TRHS_Club_Mod_2016    文件:GameRegistry.java   
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);
}
项目:CauldronGit    文件:GameRegistry.java   
/**
 * 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;
    }
}
项目:CauldronGit    文件:GameRegistry.java   
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);
}
项目:Cauldron    文件:GameRegistry.java   
/**
 * 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;
    }
}
项目:Cauldron    文件:GameRegistry.java   
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);
}
项目:Cauldron    文件:GameRegistry.java   
/**
 * 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
}
项目:Cauldron    文件:GameRegistry.java   
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);
}
项目:Cauldron    文件:GameRegistry.java   
/**
 * 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;
    }
}
项目:Cauldron    文件:GameRegistry.java   
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);
}
项目:RuneCraftery    文件:GameRegistry.java   
/**
 * 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);
    }
}
项目:RuneCraftery    文件:GameRegistry.java   
/**
 * 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);
    }
}
项目:BetterNutritionMod    文件:GameRegistry.java   
/**
 * 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);
    }
}
项目:LambdaLib    文件:WorldGenRegistration.java   
@Override
protected void register(IWorldGenerator value, RegWorldGen anno, String field)
        throws Exception {
    GameRegistry.registerWorldGenerator(value, anno.value());
}
项目:Augury    文件:ModWorldGen.java   
public static void registerWorldGen(IWorldGenerator worldGenClass, int weightedProbability){
    GameRegistry.registerWorldGenerator(worldGenClass, weightedProbability);
}
项目:EBXS-AutumnWoods    文件:AutumnWoods.java   
public List<Class<? extends IWorldGenerator>> getWorldGenerators() {
    return worldGens;
}
项目:roddenberry    文件:ModWorld.java   
public static void registerWorldGen(IWorldGenerator worldGenClass, int weightedProbablility)
{
    GameRegistry.registerWorldGenerator(worldGenClass, weightedProbablility);
}
项目:MineFantasy    文件:MineFantasyBase.java   
@EventHandler
public void load(FMLInitializationEvent evt) 
{
    Arrows.addHandler(new ArrowFireFlint());
    Arrows.addHandler(new ArrowFirerMF());

    DungeonHooks.addDungeonMob("MineFantasy.Minotaur", 50);
    DungeonHooks.addDungeonMob("MineFantasy.Basilisk", 10);
    GameRegistry.registerCraftingHandler(new CraftingHandlerMF());

    proxy.registerTileEntities();
    ItemListMF.init();
    BlockListMF.init();

    IWorldGenerator gen = new WorldGenMF();

    GameRegistry.registerWorldGenerator(gen);
    MinecraftForge.EVENT_BUS.register(new EventManagerMF());
    MinecraftForge.EVENT_BUS.register(new ArrowHandlerMF());
    MinecraftForge.ORE_GEN_BUS.register(gen);


    StatListMF.register();

    OreDictionary.registerOre("logWood",   new ItemStack(BlockListMF.log, 1, OreDictionary.WILDCARD_VALUE));
    OreDictionary.registerOre("treeLeaves",   new ItemStack(BlockListMF.leaves, 1, OreDictionary.WILDCARD_VALUE));

    OreDictionary.registerOre("treeSapling",   new ItemStack(BlockListMF.sapling, 1, OreDictionary.WILDCARD_VALUE));
    OreDictionary.registerOre("ingotSteel", new ItemStack(ItemListMF.ingotSteel));

    OreDictionary.registerOre("blockLimestone", new ItemStack(BlockListMF.limestone));
    OreDictionary.registerOre("blockSteel", new ItemStack(BlockListMF.storage, 1, 0));
    OreDictionary.registerOre("blockCopper", new ItemStack(BlockListMF.storage, 1, 1));
    OreDictionary.registerOre("blockTin", new ItemStack(BlockListMF.storage, 1, 2));
    OreDictionary.registerOre("blockBronze", new ItemStack(BlockListMF.storage, 1, 3));
    OreDictionary.registerOre("blockMithril", new ItemStack(BlockListMF.storage, 1, 4));
    OreDictionary.registerOre("blockDeepIron", new ItemStack(BlockListMF.storage, 1, 8));
    OreDictionary.registerOre("blockSilver", new ItemStack(BlockListMF.storage, 1, 5));
    OreDictionary.registerOre("blockIron", new ItemStack(BlockListMF.storage, 1, 7));

    OreDictionary.registerOre("ingotTin", new ItemStack(ItemListMF.misc, 1, ItemListMF.ingotTin));
    OreDictionary.registerOre("ingotCopper", new ItemStack(ItemListMF.misc, 1, ItemListMF.ingotCopper));
    OreDictionary.registerOre("ingotBronze", new ItemStack(ItemListMF.misc, 1, ItemListMF.ingotBronze));
       OreDictionary.registerOre("ingotSilver", new ItemStack(ItemListMF.ingotSilver));
       OreDictionary.registerOre("chain", new ItemStack(ItemListMF.misc, 1, ItemListMF.chainIron));

       OreDictionary.registerOre("oreCopper", new ItemStack(BlockListMF.oreCopper));
       OreDictionary.registerOre("oreTin", new ItemStack(BlockListMF.oreTin));
       OreDictionary.registerOre("oreSilver", new ItemStack(BlockListMF.oreUtil, 1, 0));

       OreDictionary.registerOre("oreNitre", new ItemStack(BlockListMF.oreUtil, 1, 1));
       OreDictionary.registerOre("oreNiter", new ItemStack(BlockListMF.oreUtil, 1, 2));
       OreDictionary.registerOre("oreSulfur", new ItemStack(BlockListMF.oreUtil, 1, 2));

       OreDictionary.registerOre("ingotIron", new ItemStack(ItemListMF.misc, 1, ItemListMF.ingotWroughtIron));
       OreDictionary.registerOre("ingotIron", new ItemStack(Item.ingotIron));
       OreDictionary.registerOre("salt", ItemListMF.component(ItemListMF.salt));

       OreDictionary.registerOre("ingotMithril", new ItemStack(ItemListMF.misc, 1, ItemListMF.ingotMithril));
       OreDictionary.registerOre("ingotDeepIron", new ItemStack(ItemListMF.misc, 1, ItemListMF.ingotDeepIron));

}
项目:ProtectionPlus    文件:ProPlusWorld.java   
public static void registerWorldGen(IWorldGenerator worldGenClass, int weightedProbability)
{
    GameRegistry.registerWorldGenerator(worldGenClass, weightedProbability);
}
项目:RuneCraftery    文件:ModLoaderHelper.java   
public static IWorldGenerator buildWorldGenHelper(BaseModProxy mod)
{
    return new ModLoaderWorldGenerator(mod);
}
项目:RuneCraftery    文件:ModLoaderHelper.java   
public static IWorldGenerator buildWorldGenHelper(BaseModProxy mod)
{
    return new ModLoaderWorldGenerator(mod);
}
项目:World-Generation-Manager    文件:WorldGenerator.java   
public WorldGenerator(String name, IWorldGenerator generator, String modid)
{
    this.name = name;
    this.generator = generator;
    this.modid = modid;
}
项目:IronMan    文件:imWorld.java   
public static void registerWorldGen(IWorldGenerator worldGenClass, int weightedProberblity){
    GameRegistry.registerWorldGenerator(worldGenClass, weightedProberblity);
}
项目:BetterNutritionMod    文件:ModLoaderHelper.java   
public static IWorldGenerator buildWorldGenHelper(BaseModProxy mod)
{
    return new ModLoaderWorldGenerator(mod);
}
项目:Modjam-2    文件:ModJam.java   
public void registerOre(Block b, IWorldGenerator i, String name, CreativeTabs ct)
{
    registerObject(b, ct, name);
    GameRegistry.registerWorldGenerator(i);
    b.setCreativeTab(ct);
}
项目:RuneCraftery    文件:GameRegistry.java   
/**
 * Register a world generator - something that inserts new block types into the world
 *
 * @param generator
 */
public static void registerWorldGenerator(IWorldGenerator generator)
{
    worldGenerators.add(generator);
}
项目:RuneCraftery    文件:GameRegistry.java   
/**
 * Register a world generator - something that inserts new block types into the world
 *
 * @param generator
 */
public static void registerWorldGenerator(IWorldGenerator generator)
{
    worldGenerators.add(generator);
}
项目:BetterNutritionMod    文件:GameRegistry.java   
/**
 * Register a world generator - something that inserts new block types into the world
 *
 * @param generator
 */
public static void registerWorldGenerator(IWorldGenerator generator)
{
    worldGenerators.add(generator);
}