Changer le block composant les lacs
-
Il faudrait le crash complet car il n’y a pas de trace de ton mod dans le stacktrace

-
Voici à ce lien tout ce qu’à écrit la console :
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
-
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. -
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 :
Merci d’avance.
-
Ça semble toujours être la même raison.
Essaies de réduire le nombre de passage dans la boucle. -
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
-
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. -
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.
-
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 ?
-
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.