La fonction genDecorations…
Envoyé via mobile
La fonction genDecorations…
Envoyé via mobile
Autre gros problème que je viens de voir, mes minerais ne spawn pas dans les autres mondes, mais uniquement dans le monde de base.
Class de génération :
package fr.craftesys.craftesys.generation; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import fr.craftesys.craftesys.common.Mods; public class WorldGenerationminerai implements IWorldGenerator { public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); break; case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); break; case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); break; } } private void generateEnd(World world, Random random, int x, int z) { } private void generateSurface(World world, Random random, int x, int z) { this.addOreSpawn(Mods.CobaltOre, 0, Blocks.stone, world, random, x, z, 16, 16, 5, 5, 0, 20); this.addOreSpawn(Mods.rubisOre, 0, Blocks.stone, world, random, x, z, 16, 16, 4, 5, 0, 16); this.addOreSpawn(Mods.topazeOre, 0, Blocks.stone, world, random, x, z, 16, 16, 4, 4, 0, 13); this.addOreSpawn(Mods.craftesiumOre, 0, Blocks.stone, world, random, x, z, 16, 16, 3, 4, 0, 11); } private void generateNether(World world, Random random, int x, int z) { this.addOreSpawn(Mods.BlackStone, 0, Blocks.netherrack, world, random, x, z, 16, 16, 10, 10, 0, 60); this.addOreSpawn(Mods.WhiteStone, 0, Blocks.netherrack, world, random, x, z, 16, 16, 10, 10, 0, 60); this.addOreSpawn(Mods.FireStone, 0, Blocks.netherrack, world, random, x, z, 16, 16, 10, 10, 0, 60); } public void addOreSpawn(Block block, int metadata, Block target, 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 maxX > 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."; for(int i = 0; i < chancesToSpawn; i++) { int posY = random.nextInt(128); if((posY <= maxY) && (posY >= minY)) { (new WorldGenMinable(block, metadata, maxVeinSize, target)).generate(world, random, blockXPos + random.nextInt(16), posY, blockZPos + random.nextInt(16)); } } } }
Retires le switch.
si je retire le switch, j’ai plus rien dans la fonction generate
en enlevant le switch, les minerais ne spawn plus nul part.
il faut changer “World” par “WorldType” dans la fonction ?
Retires le switch mais gardes l’appel de la fonction generateSurface et de generateNether
voila ma class du coup :
package fr.craftesys.craftesys.generation; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import fr.craftesys.craftesys.common.Mods; public class WorldGenerationminerai implements IWorldGenerator { public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { } private void generateEnd(World world, Random random, int x, int z) { } private void generateSurface(World world, Random random, int x, int z) { this.addOreSpawn(Mods.CobaltOre, 0, Blocks.stone, world, random, x, z, 16, 16, 5, 5, 0, 20); this.addOreSpawn(Mods.rubisOre, 0, Blocks.stone, world, random, x, z, 16, 16, 4, 5, 0, 16); this.addOreSpawn(Mods.topazeOre, 0, Blocks.stone, world, random, x, z, 16, 16, 4, 4, 0, 13); this.addOreSpawn(Mods.craftesiumOre, 0, Blocks.stone, world, random, x, z, 16, 16, 3, 4, 0, 11); } private void generateNether(World world, Random random, int x, int z) { this.addOreSpawn(Mods.BlackStone, 0, Blocks.netherrack, world, random, x, z, 16, 16, 10, 10, 0, 60); this.addOreSpawn(Mods.WhiteStone, 0, Blocks.netherrack, world, random, x, z, 16, 16, 10, 10, 0, 60); this.addOreSpawn(Mods.FireStone, 0, Blocks.netherrack, world, random, x, z, 16, 16, 10, 10, 0, 60); } public void addOreSpawn(Block block, int metadata, Block target, 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 maxX > 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."; for(int i = 0; i < chancesToSpawn; i++) { int posY = random.nextInt(128); if((posY <= maxY) && (posY >= minY)) { (new WorldGenMinable(block, metadata, maxVeinSize, target)).generate(world, random, blockXPos + random.nextInt(16), posY, blockZPos + random.nextInt(16)); } } } }
et la, rien ne marche, je ne trouve les minerais nul part
Remets le switch et rajoute un case avec l’id de ta dimension.
Envoyé via mobile
j’ai enlevé le switch en remettant le les generate, j’avais pas compris, si ça marche pas je test ta solution ^^
Comme ça :
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { generateNether(world, random, chunkX * 16, chunkZ * 16); generateSurface(world, random, chunkX * 16, chunkZ * 16); generateEnd(world, random, chunkX * 16, chunkZ * 16); }
oui j’avais compris entre temps :D, j’aime pas être débile merci doc ça marche
je vais peut-être te faire une déclaration, car avec cela, c’est possible que la structure se trouve.