MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Changer le block composant les lacs

    Planifier Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8.9
    28 Messages 5 Publieurs 5.5k Vues 1 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • AymericRedA Hors-ligne
      AymericRed
      dernière édition par

      @Benjamin Loison Sa variable pos n’est initialisée nulle part donc elle est forcément nulle.

      @elx9000 En regardant bien, je vois que tu as modifié ce que tu as copié de BiomeDecorator, le problème c’est que tu l’as pas fait de la bonne manière ^^
      Le code générant ton lac devrait être comme ça :

                    for (int k5 = 0; k5 < 50; ++k5)
                    {
                        int i10 = x+rand.nextInt(16)+ 8;
                        int l13 = z+rand.nextInt(16) + 8;
                        int i17 = rand.nextInt(248) + 8;
      
                            (new WorldGenLiquids(ModSurvivant.blockPotableWater)).generate(world, rand, new BlockPos(i10, i17, l13));
                   }
      

      Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

      AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

      Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
      Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

      1 réponse Dernière réponse Répondre Citer 0
      • E Hors-ligne
        elx9000
        dernière édition par

        j’ai corriger en mettant ce que tu m’a proposé mais le jeu crash.

        D’après le rapport de crash il y aurait un souci avec la ligne :

        
        (new WorldGenLiquids(ModSurvivant.blockPotableWater)).generate(world, rand, new BlockPos(i10, i17, l13));
        
        

        Merci d’avance

        1 réponse Dernière réponse Répondre Citer 0
        • robin4002R Hors-ligne
          robin4002 Moddeurs confirmés Rédacteurs Administrateurs
          dernière édition par

          Il faudrait un copier/coller du rapport de crash.

          1 réponse Dernière réponse Répondre Citer 0
          • E Hors-ligne
            elx9000
            dernière édition par

            Voici (je l’ai un peu raccourcis en enlevant les parties qui étaient répétées : je ne sais pas pourquoi, le fichier de crash report est trop volumineux, il rèpète des choses en boucle) :

            –-- Minecraft Crash Report ----
            // Shall we play a game?
            
            Time: 01/08/17 16:48
            Description: Exception generating new chunk
            
            java.lang.StackOverflowError: Exception generating new chunk
            at java.security.AccessController.doPrivileged(Native Method)
            at java.lang.ClassLoader.checkPackageAccess(Unknown Source)
            at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:175)
            at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:129)
            at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:99)
            at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:200)
            at net.minecraft.world.World.getChunkFromChunkCoords(World.java:336)
            at net.minecraft.world.World.getChunkFromBlockCoords(World.java:328)
            at net.minecraft.world.World.getBlockState(World.java:889)
            
            ...
            
            -- Chunk to be generated --
            Details:
             Location: 0,1
             Position hash: 4294967296
             Generator: RandomLevelSource
            -- Chunk to be generated --
            Details:
             Location: 1,0
             Position hash: 1
             Generator: RandomLevelSource
            
            ...
            
            -- Affected level --
            Details:
             Level name: Nouveau monde
             All players: 0 total; []
             Chunk stats: ServerChunkCache: 0 Drop: 0
             Level seed: -8297002036001858812
             Level generator: ID 00 - default, ver 1\. Features enabled: true
             Level generator options:
             Level spawn location: 0,00,0,00,0,00 - World: (0,0,0), Chunk: (at 0,0,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
             Level time: 0 game time, 0 day time
             Level dimension: 0
             Level storage version: 0x04ABD - Anvil
             Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
             Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
            -- System Details --
            Details:
             Minecraft Version: 1.8.9
             Operating System: Windows 8.1 (amd64) version 6.3
             Java Version: 1.8.0_121, Oracle Corporation
             Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
             Memory: 779675288 bytes (743 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
             JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
             IntCache: cache: 0, tcache: 1, allocated: 0, tallocated: 0
             FML: MCP 9.19 Powered by Forge 11.15.1.1747 4 mods loaded, 4 mods active
             States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
             UCHIJAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)
             UCHIJAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8.9-11.15.1.1747.jar)
             UCHIJAA Forge{11.15.1.1747} [Minecraft Forge] (forgeSrc-1.8.9-11.15.1.1747.jar)
             UCHIJAA survivant{1.0.0} [Mod Survivant] (bin)
             Loaded coremods (and transformers):
             GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
             Profiler Position: N/A (disabled)
             Player Count: 0 / 8; []
             Type: Integrated Server (map_client.txt)
             Is Modded: Definitely; Client brand changed to 'fml,forge'
            

            Merci d’avance

            1 réponse Dernière réponse Répondre Citer 0
            • E Hors-ligne
              elx9000
              dernière édition par

              Pas d’idée ?

              1 réponse Dernière réponse Répondre Citer 0
              • robin4002R Hors-ligne
                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                dernière édition par

                Il faudrait le crash complet car il n’y a pas de trace de ton mod dans le stacktrace 😕

                1 réponse Dernière réponse Répondre Citer 0
                • E Hors-ligne
                  elx9000
                  dernière édition par

                  Voici à ce lien tout ce qu’à écrit la console :

                  https://pastebin.com/ZR8u19GY

                  Et voici la classe du biome :

                  
                  package com.survivant.mod.biome;
                  
                  import java.util.Random;
                  
                  import com.survivant.mod.ModSurvivant;
                  import com.survivant.mod.blocks.BlockMod;
                  import com.survivant.mod.world.WorldGenDryGrass;
                  import com.survivant.mod.world.WorldGenPieceOfRock;
                  import com.survivant.mod.world.WorldGenRock;
                  import com.survivant.mod.world.tree.WorldGenBananaTree;
                  import com.survivant.mod.world.tree.WorldGenCocoTree;
                  
                  import net.minecraft.block.Block;
                  import net.minecraft.block.BlockLeaves;
                  import net.minecraft.block.BlockOldLeaf;
                  import net.minecraft.block.BlockOldLog;
                  import net.minecraft.block.BlockPlanks;
                  import net.minecraft.block.BlockSand;
                  import net.minecraft.block.BlockTallGrass;
                  import net.minecraft.block.material.Material;
                  import net.minecraft.block.state.IBlockState;
                  import net.minecraft.client.Minecraft;
                  import net.minecraft.init.Blocks;
                  import net.minecraft.util.BlockPos;
                  import net.minecraft.world.World;
                  import net.minecraft.world.biome.BiomeDecorator;
                  import net.minecraft.world.biome.BiomeGenBase;
                  import net.minecraft.world.chunk.ChunkPrimer;
                  import net.minecraft.world.gen.feature.WorldGenAbstractTree;
                  import net.minecraft.world.gen.feature.WorldGenLakes;
                  import net.minecraft.world.gen.feature.WorldGenLiquids;
                  import net.minecraft.world.gen.feature.WorldGenMegaJungle;
                  import net.minecraft.world.gen.feature.WorldGenShrub;
                  import net.minecraft.world.gen.feature.WorldGenTallGrass;
                  import net.minecraft.world.gen.feature.WorldGenTrees;
                  import net.minecraft.world.gen.feature.WorldGenerator;
                  
                  public class BiomeSurvivant extends BiomeGenBase
                  {
                     private boolean field_150614_aC;
                     private static final IBlockState field_181620_aE = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
                     private static final IBlockState field_181621_aF = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
                     private static final IBlockState field_181622_aG = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
                  
                     public BiomeSurvivant(int id)
                     {
                         super(id);
                         this.setBiomeName("Archipel");
                         this.topBlock = Blocks.grass.getDefaultState();
                         this.fillerBlock = Blocks.dirt.getDefaultState();
                         this.spawnableCaveCreatureList.clear();
                         this.spawnableMonsterList.clear();
                         this.spawnableCreatureList.clear();
                         this.setColor(5470985);
                         this.enableRain = true;
                         this.enableSnow = false;
                         this.setTemperatureRainfall(0.95F, 0.9F);
                         this.minHeight = -0.7F;
                         this.maxHeight = 0.2F;
                         this.theBiomeDecorator.treesPerChunk = 15;
                         this.theBiomeDecorator.reedsPerChunk = 10;
                         this.theBiomeDecorator.grassPerChunk = 15;
                         this.theBiomeDecorator.generateLakes = false;
                     }      
                  
                     @Override
                     public void genTerrainBlocks(World world, Random rand, ChunkPrimer primer, int x, int z, double noise)
                     {
                         this.biomeTerrain(world, rand, primer, x, z, noise);
                     }
                  
                     private void biomeTerrain(World world, Random rand, ChunkPrimer primer, int x, int z, double noise)
                     {                  
                         boolean flag = true;
                         IBlockState iblockstate = this.topBlock;
                         IBlockState iblockstate1 = this.fillerBlock;
                         int k = -1;
                         int l = (int)(noise / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
                         int i1 = x & 15;
                         int j1 = z & 15;
                  
                         for(int k1 = 255; k1 >= 0; –k1)
                         {
                             if (k1 <= 1)
                             {
                                 primer.setBlockState(j1, k1, i1, Blocks.bedrock.getDefaultState());
                             }
                             else
                             {
                                 IBlockState iblockstate2 = primer.getBlockState(j1, k1, i1);
                  
                                 if(iblockstate2.getBlock().getMaterial() == Material.air)
                                 {
                                     k = -1;
                                 }
                                 else if(iblockstate2.getBlock() == Blocks.stone)
                                 {
                                     if(k == -1)
                                     {
                                         if(l <= 0)
                                         {
                                             iblockstate = null;
                                             iblockstate1 = Blocks.stone.getDefaultState();
                                         }
                                         else if(k1 >= 59 && k1 <= 64)
                                         {
                                             iblockstate = this.topBlock;
                                             iblockstate1 = this.fillerBlock;
                                         }
                  
                                         if(k1 < 63 && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air))
                                         {
                                             if(this.getFloatTemperature(new BlockPos(x, k1, z)) < 0.15F)
                                             {
                                                 iblockstate = Blocks.ice.getDefaultState();
                                             }
                                             else
                                             {
                                                 iblockstate = Blocks.water.getDefaultState();
                                             }
                                         }
                                         k = 1;
                  
                                         if(k1 >= 62)
                                         {
                                             primer.setBlockState(j1, k1, i1, iblockstate);
                                         }
                                         else if(k1 < 56 - l)
                                         {
                                             iblockstate = null;
                                             iblockstate1 = Blocks.stone.getDefaultState();
                                             primer.setBlockState(j1, k1, i1, Blocks.sand.getDefaultState());
                                         }
                                         else
                                         {
                                             primer.setBlockState(j1, k1, i1, iblockstate1);
                                         }
                                     }
                                     else if(k > 0)
                                     {
                                         --k;
                                         primer.setBlockState(j1, k1, i1, iblockstate1);
                                     }
                                 }
                             }
                         }
                  
                         if (this.theBiomeDecorator.generateLakes == false)
                         {
                                 for (int k5 = 0; k5 < 50; ++k5)
                                 {
                                     int i10 = rand.nextInt(16)+ 8;
                                     int l13 = rand.nextInt(16) + 8;
                                     int i17 = rand.nextInt(248) + 8;
                  
                                    (new WorldGenLiquids(ModSurvivant.blockPotableWater)).generate(world, rand, new BlockPos(i10, i17, l13));
                                }
                         }
                     }
                  
                     public WorldGenAbstractTree genBigTreeChance(Random rand)
                     {
                         return (WorldGenAbstractTree)(rand.nextInt(10) == 0 ? this.worldGeneratorBigTree : (rand.nextInt(2) == 0 ? new WorldGenShrub(field_181620_aE, field_181622_aG) : (!this.field_150614_aC && rand.nextInt(4) == 0 ? new WorldGenMegaJungle(false, 10, 20, field_181620_aE, field_181621_aF) : (rand.nextInt(2) == 0 ? new WorldGenBananaTree(false, 4 + rand.nextInt(7), field_181620_aE, field_181621_aF, true) : new WorldGenCocoTree(false, 4 + rand.nextInt(7), field_181620_aE, field_181621_aF, true)))));
                     }
                  
                     public WorldGenerator getRandomWorldGenForGrass(Random rand)
                     {              
                         return rand.nextInt(20) == 0 ? new WorldGenDryGrass() : rand.nextInt(30) == 0 ? new WorldGenPieceOfRock() : rand.nextInt(50) == 0 ? new WorldGenRock() : rand.nextInt(20) == 0 ? new WorldGenTallGrass(BlockTallGrass.EnumType.DEAD_BUSH) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
                     }
                  }
                  
                  

                  Merci d’avance

                  1 réponse Dernière réponse Répondre Citer 0
                  • robin4002R Hors-ligne
                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                    dernière édition par

                    alors vu que tu tente de générer à chaque fois un lac aux mêmes coordonnées, ce n’est pas étonnant que le jeu plante complètement.

                    new BlockPos(x + i10, i17, z + l13)
                    aura plus de chance de fonctionner.

                    1 réponse Dernière réponse Répondre Citer 0
                    • E Hors-ligne
                      elx9000
                      dernière édition par

                      Le jeu crash encore à la création du monde, voici, à ce lien, ce qu’il y a noté dans le console après le crash :

                      https://pastebin.com/r445Wjud

                      Merci d’avance.

                      1 réponse Dernière réponse Répondre Citer 0
                      • robin4002R Hors-ligne
                        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                        dernière édition par

                        Ça semble toujours être la même raison.
                        Essaies de réduire le nombre de passage dans la boucle.

                        1 réponse Dernière réponse Répondre Citer 0
                        • E Hors-ligne
                          elx9000
                          dernière édition par

                          J’ai mis 5 tours dans la boucle, ça ne change rien. Il n’y aurait pas une autre solution pour générer mon liquide

                          1 réponse Dernière réponse Répondre Citer 0
                          • robin4002R Hors-ligne
                            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                            dernière édition par

                            Je n’ai plus de workspace 1.8.9 donc je ne peux pas regarder de mon côté.
                            En 1.10.2 par contre la génération de lac se fait dans la fonction decorate qui est appelé après, faut voir si c’est pareil en 1.8, ça expliquerai ton soucis.

                            1 réponse Dernière réponse Répondre Citer 0
                            • E Hors-ligne
                              elx9000
                              dernière édition par

                              Le problème de crash est résolu, j’ai fait ça :

                              
                              @Override
                                 public void decorate(World worldIn, Random rand, BlockPos pos)
                                 {        
                              
                                     if (this.theBiomeDecorator.generateLakes == false)
                                     {
                                         for (int k5 = 0; k5 < 50; ++k5)
                                         {
                                             int i10 = rand.nextInt(16)+ 8;
                                             int l13 = rand.nextInt(16) + 8;
                                             int i17 = rand.nextInt(248) + 8;
                              
                                             if (i17 > 0)
                                             {
                                                 int k19 = rand.nextInt(i17);
                                                 BlockPos blockpos = pos.add(i10, k19, l13);
                                                 (new WorldGenLiquids(ModSurvivant.blockPotableWater)).generate(worldIn, rand, blockpos);
                                             }
                                         }
                                     }
                              
                                 }
                              
                              

                              Cependant, j 'ai de nouveaux soucis :

                              • le reste de ma décorations (arbre, canne à sucre,…) à totalement disparu.
                              • mon liquide spawn bien, mais il est extrêmement rare à trouver, comment le rendre plus fréquent ?
                              • mon liquide ne spawn qu’en “cascade” et pas en lac.
                              • malgrès this.theBiomeDecorator.generatesLakes = false; les lacs d’eau basique spawnent toujours (je pense que c’est en lien avec la décoration du biome qui ne fonctionne pas).
                                Merci par avance pour votre aide.
                              1 réponse Dernière réponse Répondre Citer 0
                              • robin4002R Hors-ligne
                                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                dernière édition par

                                Ajoutes super.decorate(worldIn, rand, pos); avant ton if pour récupérer la génération des autres décorations.
                                Pour la rareté, augmente la boucle for.
                                Pour le fait que les lacs qui ne spawn pas, je ne sais pas 😕

                                Et pour le this.theBiomeDecorator.generatesLakes = false; tu as bien mis ça dans le constructeur ?

                                1 réponse Dernière réponse Répondre Citer 0
                                • E Hors-ligne
                                  elx9000
                                  dernière édition par

                                  Oui je l’ai mis dans le constructeur. Avec le super.decorate(worldIn, rand, pos); ça fonctionne.

                                  Pour générer les lacs, j’ai trouvé qu’en remplaçant WorldGenLiquids par WorldGenLakes et en modifiant les parametres (taille de la boucle,…) on génère des lacs.

                                  Voilà à quoi ressemble la fonction :

                                  
                                  @Override
                                     public void decorate(World worldIn, Random rand, BlockPos pos)
                                     {            
                                         if (this.theBiomeDecorator.generateLakes == false)
                                         {
                                             for (int k5 = 0; k5 < 1000; ++k5)
                                             {
                                                 int i10 = rand.nextInt(16)+ 8;
                                                 int l13 = rand.nextInt(16) + 8;
                                                 int i17 = rand.nextInt(248) + 8;
                                  
                                                 if (i17 > 0)
                                                 {
                                                     int k19 = rand.nextInt(i17);
                                                     BlockPos blockpos = pos.add(i10, k19, l13);
                                                     (new WorldGenLiquids(ModSurvivant.blockPotableWater)).generate(worldIn, rand, blockpos);
                                                 }
                                             }
                                  
                                             for (int k5 = 0; k5 < 5; ++k5)
                                             {
                                                 int i10 = rand.nextInt(16)+ 8;
                                                 int l13 = rand.nextInt(16) + 8;
                                                 int i17 = rand.nextInt(248) + 8;
                                  
                                                 if (i17 > 0)
                                                 {
                                                     int k19 = rand.nextInt(i17);
                                                     BlockPos blockpos2 = pos.add(i10, k19, l13);
                                                     (new WorldGenLakes(ModSurvivant.blockPotableWater)).generate(worldIn, rand, blockpos2);
                                                 }
                                             }
                                         }
                                  
                                         super.decorate(worldIn, rand, pos);
                                     }
                                  
                                  

                                  Je passe le sujet en résolu. Encore merci.

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • 1
                                  • 2
                                  • 1 / 2
                                  • Premier message
                                    Dernier message
                                  Design by Woryk
                                  ContactMentions Légales

                                  MINECRAFT FORGE FRANCE © 2024

                                  Powered by NodeBB