Générer des minerais
-
Envoie tes codes ?
-
package shaarfight.worldgen; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import shaarfight.common.ShaarMod; import cpw.mods.fml.common.IWorldGenerator { public class IlluveWorldGeneration implements IWorldGenerator { public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ swich (world.provider.dimensionId) { case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); } } private void generateSurface(World world, Random random, int x, int z) { } private void generateNether(World world, Random random, int x, int z) { this.addOreSpawn(ShaarMod.oreIlluve, world, random, x, z, 16, 16, 1 + random.netInt(4), 50, 5, ); } public void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY){ assert maxY > minY : "La position Y maximum doit être supérieure à la position Y minimum."; assert maX > 0 && maxX <= 16 : "X doit se trouver entre 0 et 16."; assert minY > 0 : "La position Y minimum doit être supérieure à 0."; assert maxY < 256 && maxY > 0 : "La position Y maximum doit se trouver entre 0 et 256."; assert maxZ > 0 && maxZ <= 16 : "Z doit se trouver entre 0 et 16."; int diffBtwnMinMaxY = maxY - minY; for (int x = 0; x < chancesToSpawn; x++) { int posX = blockXPos + random.nextInt(maxX); int posY = minY + random.nextInt(diffBtwnMinMaxY); int posZ = blockZPos + random.nextInt(maxZ); (new WorldGenMinable(ShaarMod.oreIlluve, 1 + random.nextInt(4))).generate(world, random, posX, posY, posZ); } } }Voilà mon code de ma classe IlluveWorldGeneration.
-
@ryken vas voir le tutoriel 1.6 de robin, c’est la même chose sauf que tu enleves le blockID
-
En effet, sur ce tutoriel ça ne risque pas de fonctionner car il essaye de remplacer la stone, or il n’y a pas de stone dans le nether.
-
package shaarfight.worldgen; import java.util.Random; import shaarfight.common.ShaarMod; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; public class IlluveWorldGeneration implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { } { switch(world.provider.dimensionID) { case -1: this.generateNether(world, chunkX * 16, chunkZ * 16, random); break; } private void generateNether(World world, int x, int z, Random rand) { for(int i = 0; i < 1; i++) { (new WorldGenMinable(ShaarMod.oreIlluve, 0, 5, Blocks.netherrack)).generate(world, rand, x + rand.nextInt(16), rand.nextInt(120), z + rand.nextInt(16)); } { } } } } -
Comme ça, ça devrait être bon oui.
-
maintenant j’ai des erreurs sur switch(world.provider.dimensionID) sur le world, ainsi que sur this.generateNether(world, chunkX * 16, chunkZ * 16, random); sur le world, chunkX, chunkZ, random mais aussi sur private void generateNether(World world, int x, int z, Random rand) sur les virgules et sur la parenthèse de fin.
-
Il doit y avoir des micro-caractères dans ces lignes, regarde si tu les vois.
-
Je ne vois rien dedans
-
Réécrit les caractères à main.
-
Sa met fait toujours pareil
-
Remplace dimensionID par dimensionId
Pour le reste je sais pas. -
sa change rien, bon bah je vais abandonner

-
Eclipse te donne quoi comme erreur ? (le nom de l’erreur).
-
pour les virgules : Syntax error on token “,”, ; expected
pour le world.provider.dimensionId : world cannot be resolved to a variable
pour le generateNether : void is an invalid type for the variable generateNetherSi ce n’est pas bah je sais pas je n’est que cela.
-
En fait j’avais pas fait attention, la classe était completement fausse niveau accolade. Prend celle-ci :
package shaarfight.worldgen; import java.util.Random; import shaarfight.common.ShaarMod; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; public class IlluveWorldGeneration implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case -1: this.generateNether(world, chunkX * 16, chunkZ * 16, random); break; } } private void generateNether(World world, int x, int z, Random rand) { for(int i = 0; i < 1; i++) { (new WorldGenMinable(ShaarMod.oreIlluve, 0, 5, Blocks.netherrack)).generate(world, rand, x + rand.nextInt(16), rand.nextInt(120), z + rand.nextInt(16)); } } } -
Plus aucune erreur cependant mon minerai ne se genere toujours pas je comprend pas.
-
package shaarfight.worldgen; import java.util.Random; import shaarfight.common.ShaarMod; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; public class IlluveWorldGeneration implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case -1: this.generateNether(world, chunkX * 16, chunkZ * 16, random); break; } } private void generateNether(World world, int x, int z, Random rand) { //change le i < 100 pour augmenter ou diminuer la rareté car a 1 il vas pas beaucoup se générer. for(int i = 0; i < 100; i++) { (new WorldGenMinable(ShaarMod.oreIlluve, 0, 5, Blocks.netherrack)).generate(world, rand, x + rand.nextInt(16), rand.nextInt(120), z + rand.nextInt(16)); } } } -
Merci sa marche mais quelle est la rareté du quartz ?
-
je ne me rappelle plus dans quel classe elle est mise désoler, tu devrais regarder dans le code de la dimension

