Impossible trouver biome et structure en même temps
-
protected signifie que tu peux y accéder vu que ta classe est extends celle où se trouve la fonction.
-
mais justement avec le ctrl+espace je ne trouve pas cette fonction
-
Est-ce que au moins ta classe est extends de cette classe ?
-
Envoies la classe de ton biome.
-
BiomeTest
package fr.craftesys.craftesys.generation; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fr.craftesys.craftesys.common.Mods; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; public class BiomeTest extends BiomeGenBase { public BiomeTest(int id) { super(id); this.spawnableCreatureList.add(new SpawnListEntry(EntityZombie.class, 6, 3, 9)); this.theBiomeDecorator.treesPerChunk = 5; this.theBiomeDecorator.grassPerChunk = 1; this.theBiomeDecorator.bigMushroomsPerChunk = 2; this.topBlock = Mods.biome; this.fillerBlock = Mods.biome; this.waterColorMultiplier = 0x800000; } @SideOnly(Side.CLIENT) public int getSkyColorByTemp(float par1) { return 0xCC0000; } private void generateSurface(World world, Random random, int x, int z) { int x1 = x + random.nextInt(16); int y1 = random.nextInt(128); int z1 = z + random.nextInt(16); for (int i = 0; i < 1000; i++) // Il vaut mieux mettre une valeur élevée { System.out.println("message de debug"); (new WorldGen()).generate(world, random, x1, y1, z1); } } public WorldGenerator getRandomWorldGenForTrees(Random par1Random) { return (WorldGenerator)(par1Random.nextInt(15) == 0 ? new WorldGenTrees(false, 6, 2, 2, true) : (par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : new WorldGenTrees(false, 4, 0, 0, true))); } }BiomeTestLayer
package fr.craftesys.craftesys.generation; import java.util.ArrayList; import java.util.List; import java.util.Random; import fr.craftesys.craftesys.common.Mods; import net.minecraft.util.WeightedRandom; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; import net.minecraftforge.common.BiomeManager; import net.minecraftforge.common.BiomeManager.BiomeEntry; public class BiomeTestLayer extends GenLayer { private List <biomeentry>desertBiomes = new ArrayList<biomeentry>(); private List <biomeentry>warmBiomes = new ArrayList<biomeentry>(); private List <biomeentry>coolBiomes = new ArrayList<biomeentry>(); private List <biomeentry>icyBiomes = new ArrayList<biomeentry>(); public BiomeTestLayer(long par1, GenLayer layer, WorldType worldType) { super(par1); this.parent = layer; this.desertBiomes.addAll(BiomeManager.desertBiomes); this.warmBiomes.addAll(BiomeManager.warmBiomes); this.coolBiomes.addAll(BiomeManager.coolBiomes); this.icyBiomes.addAll(BiomeManager.icyBiomes); if (worldType == WorldType.DEFAULT) { desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 10)); desertBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10)); desertBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10)); desertBiomes.add(new BiomeEntry(BiomeGenBase.swampland, 10)); desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10)); desertBiomes.add(new BiomeEntry(BiomeGenBase.taiga, 10)); desertBiomes.add(new BiomeEntry(Mods.biometest, 110)); } else { desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 30)); desertBiomes.add(new BiomeEntry(BiomeGenBase.savanna, 20)); desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10)); desertBiomes.add(new BiomeEntry(Mods.biometest, 110)); } } public int[] getInts(int par1, int par2, int par3, int par4) { int[] aint = this.parent.getInts(par1, par2, par3, par4); int[] aint1 = IntCache.getIntCache(par3 * par4); for (int i1 = 0; i1 < par4; ++i1) { for (int j1 = 0; j1 < par3; ++j1) { this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2)); int k1 = aint[j1 + i1 * par3]; int l1 = (k1 & 3840) >> 8; k1 &= -3841; if (isBiomeOceanic(k1)) { aint1[j1 + i1 * par3] = k1; } else if (k1 == BiomeGenBase.mushroomIsland.biomeID) { aint1[j1 + i1 * par3] = k1; } else if (k1 == 1) { if (l1 > 0) { if (this.nextInt(3) == 0) { aint1[j1 + i1 * par3] = BiomeGenBase.mesaPlateau.biomeID; } else { aint1[j1 + i1 * par3] = BiomeGenBase.mesaPlateau_F.biomeID; } } else { System.out.println("biome spawn"); BiomeGenBase biome = ((BiomeEntry)WeightedRandom.getItem(this.desertBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.desertBiomes))))).biome; if(biome == null) biome = BiomeGenBase.desert; aint1[j1 + i1 * par3] = biome.biomeID; } } else if (k1 == 2) { if (l1 > 0) { aint1[j1 + i1 * par3] = BiomeGenBase.jungle.biomeID; } else { aint1[j1 + i1 * par3] = ((BiomeEntry)WeightedRandom.getItem(this.warmBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.warmBiomes) / 10) * 10))).biome.biomeID; } } else if (k1 == 3) { if (l1 > 0) { aint1[j1 + i1 * par3] = BiomeGenBase.megaTaiga.biomeID; } else { aint1[j1 + i1 * par3] = ((BiomeEntry)WeightedRandom.getItem(this.coolBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.coolBiomes) / 10) * 10))).biome.biomeID; } } else if (k1 == 4) { aint1[j1 + i1 * par3] = ((BiomeEntry)WeightedRandom.getItem(this.icyBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.icyBiomes) / 10) * 10))).biome.biomeID; } else { aint1[j1 + i1 * par3] = BiomeGenBase.mushroomIsland.biomeID; } } } return aint1; } private void generateSurface(World world, Random random, int x, int z) { int x1 = x + random.nextInt(16); int y1 = random.nextInt(128); int z1 = z + random.nextInt(16); for (int i = 0; i < 1000; i++) // Il vaut mieux mettre une valeur élevée { System.out.println("message de debug"); (new WorldGen()).generate(world, random, x1, y1, z1); } } }worldtypetest :
package fr.craftesys.craftesys.generation; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayerBiomeEdge; import net.minecraft.world.gen.layer.GenLayerZoom; public class WorldTypeTest extends WorldType { public WorldTypeTest(int par1, String name) { super(name); } public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer) { GenLayer ret = new BiomeTestLayer(200L, parentLayer, this); ret = GenLayerZoom.magnify(1000L, ret, 2); ret = new GenLayerBiomeEdge(1000L, ret); return ret; } } ```</biomeentry></biomeentry></biomeentry></biomeentry></biomeentry></biomeentry></biomeentry></biomeentry> -
Autant pour moi, la fonction genDecorations est dans la classe BiomeDecorator et non dans BiomeGenBase #fail
Donc dans BiomeGenBase il faut utiliser la fonction public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) pour spécifier un BiomeDecorator différent. -
et dans cette fonction je dois mettre quoi ?
-
Tu dois spécifier ton décorateur custom (créé une nouvelle classe extends BiomeDecorator et dans getModdedBiomeDecorator tu mets return new TonDecorateurDeBiome(this);).
-
et je met quoi justement dans la nouvelle classe ^^
-
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 marcheje vais peut-être te faire une déclaration, car avec cela, c’est possible que la structure se trouve.