1.7.10 Generer un minerais uniquement dans un biome



  • Bonjour, je voudrais savoir si on peut generer un minerai seulement dans 1 biome et si oui comment ?
    merci !



  • déjà a tu créer ton minerai ?

    si oui dans la class implement a IWorldGenerator tu met

    private void Generate(nom de ton biome)(World world, int i, int j, Random random)
        {
    
        }
    

    essaye avec çà mais je suis pas sûr

    ta class entière

    package com.nugarium.nugarMod.world;
    
    
    import com.nugarium.nugarMod.block.minerais.Nugarium_Ore;
    import cpw.mods.fml.common.IWorldGenerator;
    import net.minecraft.block.Block;
    import net.minecraft.init.Blocks;
    import net.minecraft.world.World;
    import net.minecraft.world.biome.BiomeGenBase;
    import net.minecraft.world.chunk.IChunkProvider;
    import net.minecraft.world.gen.feature.WorldGenMinable;
    
    import java.util.Random;
    
    public class WorldGenLouk implements IWorldGenerator
    {
    
        @Override
        public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
        {
            switch(world.provider.dimensionId)
            {
                case -1:
                    GenerateNether(world, chunkX * 16, chunkZ * 16, random);
                    break;
    
                case 0:
                    GenerateOverWorld(world, chunkX * 16, chunkZ * 16, random);
                    break;
    
                case 1:
                    GenerateEnd(world, chunkX * 16, chunkZ * 16, random);
                    break;
    
                case 2:
                    Generate(nom de ton biome)(world, chunkX * 16, chunkZ * 16, random);
                    break;
            }
        }
    
        private void addOre(Block block, Block blockSpawn, Random random, World world, int posX, int posZ, int minY, int maxY, int minV, int maxV, int spawnChance)
        {
            for(int i = 0; i < spawnChance; i++)
            {
                int chunkSize = 16;
                int Xpos = posX + random.nextInt(chunkSize);
                int Ypos = minY + random.nextInt(maxY - minY);
                int Zpos = posZ + random.nextInt(chunkSize);
    
                new WorldGenMinable(block, maxV, blockSpawn).generate(world, random, Xpos, Ypos, Zpos);
            }
        }
    
        private void addStructure(String string, Random random, World world, int posX, int posZ, int minY, int maxY, int spawnChance)
        {
            for(int i = 0; i < spawnChance ; i++)
            {
                int chunkSize = 16;
                int Xpos = posX + random.nextInt(chunkSize);
                int Ypos = minY + random.nextInt(maxY - minY);
                int Zpos = posZ + random.nextInt(chunkSize);
    
    
            }
        }
    
        private void GenerateNether(World world, int i, int j, Random random)
        {
    
        }
    
        private void GenerateOverWorld(World world, int i, int j, Random random)
        {
            addOre(Nugarium_Ore.Nugar_Ore, Blocks.stone, random, world, i, j,1, 10, 1, 3, 2);
    
        }
    
        private void GenerateEnd(World world, int i, int j, Random random)
        {
    
        }
    
        private void Generate(nom de ton biome)(World world, int i, int j, Random random)
        {
    
        }
    
    
    }
    
    

    et puis celle de ton WorldRegister:

    package com.nugarium.nugarMod.world;
    
    import cpw.mods.fml.common.IWorldGenerator;
    import cpw.mods.fml.common.registry.GameRegistry;
    
    public class WorldRegister
    {
        public static void mainRegistry()
        {
            registerWorldGen(new WorldGenLouk(), -1);
            registerWorldGen(new WorldGenLouk(), 0);
            registerWorldGen(new WorldGenLouk(), 1);
            registerWorldGen(new WorldGenLouk(), 2);
        }
    
        public static void registerWorldGen(IWorldGenerator iGenerator, int modGenerationWeight)
        {
            GameRegistry.registerWorldGenerator(iGenerator, modGenerationWeight);
        }
    }
    
    


  • déjà a tu créer ton minerai ?

    si oui dans la class implement a IWorldGenerator tu met

    private void Generate(nom de ton biome)(World world, int i, int j, Random random)
        {
    
        }
    

    essaye avec çà mais je suis pas sûr

    ta class entière

    package com.nugarium.nugarMod.world;
    
    
    import com.nugarium.nugarMod.block.minerais.Nugarium_Ore;
    import cpw.mods.fml.common.IWorldGenerator;
    import net.minecraft.block.Block;
    import net.minecraft.init.Blocks;
    import net.minecraft.world.World;
    import net.minecraft.world.biome.BiomeGenBase;
    import net.minecraft.world.chunk.IChunkProvider;
    import net.minecraft.world.gen.feature.WorldGenMinable;
    
    import java.util.Random;
    
    public class WorldGenLouk implements IWorldGenerator
    {
    
        @Override
        public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
        {
            switch(world.provider.dimensionId)
            {
                case -1:
                    GenerateNether(world, chunkX * 16, chunkZ * 16, random);
                    break;
    
                case 0:
                    GenerateOverWorld(world, chunkX * 16, chunkZ * 16, random);
                    break;
    
                case 1:
                    GenerateEnd(world, chunkX * 16, chunkZ * 16, random);
                    break;
    
                case 2:
                    Generate(nom de ton biome)(world, chunkX * 16, chunkZ * 16, random);
                    break;
            }
        }
    
        private void addOre(Block block, Block blockSpawn, Random random, World world, int posX, int posZ, int minY, int maxY, int minV, int maxV, int spawnChance)
        {
            for(int i = 0; i < spawnChance; i++)
            {
                int chunkSize = 16;
                int Xpos = posX + random.nextInt(chunkSize);
                int Ypos = minY + random.nextInt(maxY - minY);
                int Zpos = posZ + random.nextInt(chunkSize);
    
                new WorldGenMinable(block, maxV, blockSpawn).generate(world, random, Xpos, Ypos, Zpos);
            }
        }
    
        private void addStructure(String string, Random random, World world, int posX, int posZ, int minY, int maxY, int spawnChance)
        {
            for(int i = 0; i < spawnChance ; i++)
            {
                int chunkSize = 16;
                int Xpos = posX + random.nextInt(chunkSize);
                int Ypos = minY + random.nextInt(maxY - minY);
                int Zpos = posZ + random.nextInt(chunkSize);
    
    
            }
        }
    
        private void GenerateNether(World world, int i, int j, Random random)
        {
    
        }
    
        private void GenerateOverWorld(World world, int i, int j, Random random)
        {
            addOre(Nugarium_Ore.Nugar_Ore, Blocks.stone, random, world, i, j,1, 10, 1, 3, 2);
    
        }
    
        private void GenerateEnd(World world, int i, int j, Random random)
        {
    
        }
    
        private void Generate(nom de ton biome)(World world, int i, int j, Random random)
        {
    
        }
    
    
    }
    
    

    et puis celle de ton WorldRegister:

    package com.nugarium.nugarMod.world;
    
    import cpw.mods.fml.common.IWorldGenerator;
    import cpw.mods.fml.common.registry.GameRegistry;
    
    public class WorldRegister
    {
        public static void mainRegistry()
        {
            registerWorldGen(new WorldGenLouk(), -1);
            registerWorldGen(new WorldGenLouk(), 0);
            registerWorldGen(new WorldGenLouk(), 1);
            registerWorldGen(new WorldGenLouk(), 2);
        }
    
        public static void registerWorldGen(IWorldGenerator iGenerator, int modGenerationWeight)
        {
            GameRegistry.registerWorldGenerator(iGenerator, modGenerationWeight);
        }
    }
    
    

Log in to reply