Ajouter une nouvelle dimension
-
Regarde si il y a une fonction onItemRigthClick(…)
-
Oui j’ai essayé avec ca mais ca marche pas non plus xD Jvois pas pourquoi ca marche pas en fait oO
-
EUREKA ! Fallais rajouter .getDefaultState après chaque block du portail voici le code pour la 1.8 ceux qui le désire
package mod.common.item; import mod.DinoCraft; import mod.common.block.BlockRegister; import mod.common.world.structure.DimensionRegister; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; public class ItemEnhancer extends Item { public ItemEnhancer() { this.setUnlocalizedName("itemEnhancer"); } public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing facing, float par8, float par9, float par10) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); System.out.println("CA MARCHE ?"); if(world.getBlockState(new BlockPos(x, y, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 1, y, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 4, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 1, y + 4, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x - 1, y + 1, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x - 1, y + 2, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x - 1, y + 3, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 2, y + 1, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 2, y + 2, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 2, y + 3, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { for(int l = 0; l < 2; l++) { for(int h = 0; h < 3; h++) { world.setBlockState(new BlockPos(x + l, y + 1 + h, z), BlockRegister.BlockPortail.getDefaultState()); System.out.println("CA MARCHE 1?"); } } } } } } } } } } } if(world.getBlockState(new BlockPos(x - 1, y, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 4, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x - 1, y + 4, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x - 2, y + 1, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x - 2, y + 2, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x - 2, y + 3, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 1, y + 1, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 1, y + 2, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x + 1, y + 3, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { for(int l = 0; l < 2; l++) { for(int h = 0; h < 3; h++) { world.setBlockState(new BlockPos(x - l, y + 1 + h, z) , BlockRegister.BlockPortail.getDefaultState()); System.out.println("CA MARCHE 2?"); } } } } } } } } } } } if(world.getBlockState(new BlockPos(x, y, z + 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 4, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 4, z + 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 1, z - 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 2, z - 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 3, z - 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 1, z + 2)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 2, z + 2)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 3, z + 2)).equals(BlockRegister.BlockAmbre.getDefaultState())) { for(int l = 0; l < 2; l++) { for(int h = 0; h < 3; h++) { world.setBlockState(new BlockPos(x, y + 1 + h, z + l), BlockRegister.BlockPortail.getDefaultState()); System.out.println("CA MARCHE 3?"); } } } } } } } } } } } if(world.getBlockState(new BlockPos(x, y, z - 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 4, z)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 4, z - 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 1, z + 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 2, z + 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 3, z + 1)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 1, z - 2)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 2, z - 2)).equals(BlockRegister.BlockAmbre.getDefaultState())) { if(world.getBlockState(new BlockPos(x, y + 3, z - 2)).equals(BlockRegister.BlockAmbre.getDefaultState())) { for(int l = 0; l < 2; l++) { for(int h = 0; h < 3; h++) { world.setBlockState(new BlockPos(x, y + 1 + h, z - l), BlockRegister.BlockPortail.getDefaultState()); System.out.println("CA MARCHE 4?"); } } } } } } } } } } } } return false; } }
-
Bonjour tout le monde, j’ai un petit problème quand j’essaye d’appliquer le mod “île flottante” en 1.8…
Le soucie doit provenir normalement de la classe ChunkProvider :
package mods.emotion.dimension; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.feature.WorldGenBigTree; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenTrees; public class SkyChunkProvider implements IChunkProvider { private Random rand; private NoiseGeneratorOctaves noiseGen1; private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorOctaves noiseGen4; public NoiseGeneratorOctaves noiseGen5; public NoiseGeneratorOctaves noiseGen6; private NoiseGeneratorOctaves noiseGen7; public NoiseGeneratorOctaves mobSpawnerNoise; private World worldObj; private double[] noiseArray; private double[] bNoise1; private double[] bNoise2; private double[] bNoise3; private BiomeGenBase[] biomesForGeneration; double[] noise1; double[] noise2; double[] noise3; double[] noise4; double[] noise5; int[][] field_914_i = new int[32][32]; private double[] generatedTemperatures; public Block topBlock; public Block fillerBlock; public SkyChunkProvider(World world, long seed) { this.bNoise1 = new double[256]; this.bNoise2 = new double[256]; this.bNoise3 = new double[256]; this.worldObj = world; this.rand = new Random(seed); this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 32); this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 64); this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 4); this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 10); this.noiseGen7 = new NoiseGeneratorOctaves(this.rand, 16); this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); } public void generateTerrain(int i, int j, Block[] block, BiomeGenBase[] abiomes) { byte byte0 = 2; int k = byte0 + 1; byte byte1 = 33; int l = byte0 + 1; this.noiseArray = initializeNoiseField(this.noiseArray, i * byte0, 0, j * byte0, k, byte1, l); for(int i1 = 0; i1 < byte0; i1++) { for(int j1 = 0; j1 < byte0; j1++) { for(int k1 = 0; k1 < 32; k1++) { double d = 0.25D; double d1 = this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 0)]; double d2 = this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 0)]; double d3 = this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 0)]; double d4 = this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 0)]; double d5 = (this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 1)] - d1) * d; double d6 = (this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 1)] - d2) * d; double d7 = (this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 1)] - d3) * d; double d8 = (this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 1)] - d4) * d; for(int l1 = 0; l1 < 4; l1++) { double d9 = 0.125D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for(int i2 = 0; i2 < 8; i2++) { int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1; char c = ''; double d14 = 0.125D; double d15 = d10; double d16 = (d11 - d10) * d14; for(int k2 = 0; k2 < 8; k2++) { Block l2 = Blocks.air; if(d15 > 0.0D) { l2 = Blocks.stone; } block[j2] = l2; j2 += c; d15 += d16; } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } private double[] initializeNoiseField(double[] ad, int i, int j, int k, int l, int i1, int j1) { if(ad == null) { ad = new double[l * i1 * j1]; } double d = 684.41200000000003D; double d1 = 684.41200000000003D; this.noise4 = this.noiseGen6.generateNoiseOctaves(this.noise4, i, k, l, j1, 1.121D, 1.121D, 0.5D); this.noise5 = this.noiseGen7.generateNoiseOctaves(this.noise5, i, k, l, j1, 200.0D, 200.0D, 0.5D); d *= 2.0D; this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, i, j, k, l, i1, j1, d / 80.0D, d1 / 160.0D, d / 80.0D); this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, i, j, k, l, i1, j1, d, d1, d); this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, i, j, k, l, i1, j1, d, d1, d); int k1 = 0; int l1 = 0; for(int j2 = 0; j2 < l; j2++) { for(int l2 = 0; l2 < j1; l2++) { double d4 = 1.0D; d4 *= d4; d4 *= d4; d4 = 1.0D - d4; double d5 = (this.noise4[l1] + 256.0D) / 512.0D; d5 *= d4; if(d5 > 1.0D) { d5 = 1.0D; } double d6 = this.noise5[l1] / 8000.0D; if(d6 < 0.0D) { d6 = -d6 * 0.3D; } d6 = d6 * 3.0D - 2.0D; if(d6 > 1.0D) { d6 = 1.0D; } d6 /= 8.0D; d6 = 0.0D; if(d5 < 0.0D) { d5 = 0.0D; } d5 += 0.5D; d6 = d6 * i1 / 16.0D; l1++; double d7 = i1 / 2.0D; for(int j3 = 0; j3 < i1; j3++) { double d8 = 0.0D; double d9 = (j3 - d7) * 8.0D / d5; if(d9 < 0.0D) { d9 *= -1.0D; } double d10 = this.noise1[k1] / 512.0D; double d11 = this.noise2[k1] / 512.0D; double d12 = (this.noise3[k1] / 10.0D + 1.0D) / 2.0D; if(d12 < 0.0D) { d8 = d10; } else if(d12 > 1.0D) { d8 = d11; } else { d8 = d10 + (d11 - d10) * d12; } d8 -= 8.0D; int k3 = 32; if(j3 > i1 - k3) { double d13 = (j3 - (i1 - k3)) / (k3 - 1.0F); d8 = d8 * (1.0D - d13) + -30.0D * d13; } k3 = 8; if(j3 < k3) { double d14 = (k3 - j3) / (k3 - 1.0F); d8 = d8 * (1.0D - d14) + -30.0D * d14; } ad[k1] = d8; k1++; } } } return ad; } public void replaceBlockForBiome(int i, int j, Block[] block, BiomeGenBase[] abiome) { double d = 0.03125D; this.bNoise1 = this.noiseGen4.generateNoiseOctaves(this.bNoise1, i * 16, j * 16, 0, 16, 16, 1, d, d, 1.0D); this.bNoise2 = this.noiseGen4.generateNoiseOctaves(this.bNoise2, i * 16, 109, j * 16, 16, 1, 16, d, 1.0D, d); this.bNoise3 = this.noiseGen5.generateNoiseOctaves(this.bNoise3, i * 16, j * 16, 0, 16, 16, 1, d * 2.0D, d * 2.0D, d * 2.0D); for(int k = 0; k < 16; k++) { for(int l = 0; l < 16; l++) { int i1 = (int)(this.bNoise3[(k + l * 16)] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); int j1 = -1; this.topBlock = Blocks.grass; this.fillerBlock = Blocks.dirt; Block block1 = this.topBlock; Block block2 = this.fillerBlock; Block stone = Blocks.stone; if(block1 == Blocks.air) { block1 = Blocks.grass; } if(block2 == Blocks.air) { block2 = Blocks.dirt; } if(stone == Blocks.air) { stone = Blocks.stone; } for(int k1 = 127; k1 >= 0; k1–) { int l1 = (l * 16 + k) * 128 + k1; Block block3 = block[l1]; if(block3 == Blocks.air) { j1 = -1; } else if(block3 == stone) { if(j1 == -1) { if(i1 <= 0) { block1 = Blocks.air; block2 = stone; } j1 = i1; if(k1 >= 0) { block[l1] = block1; } else { block[l1] = block2; } } else if(j1 > 0) { j1–; block[l1] = block2; } } } } } } public List getPossibleCreatures(EnumCreatureType enumcreaturetype, int x, int y, int z) { BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(new BlockPos(x, y, z)); return var5 == null ? null : var5.getSpawnableList(enumcreaturetype); } @Override public boolean chunkExists(int x, int z) { return true; } @Override public Chunk provideChunk(int x, int z) { this.rand.setSeed(x * 391279128714L + z * 132894987741L); Block[] ablock = new Block[32768]; this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); generateTerrain(x, z, ablock, this.biomesForGeneration); replaceBlockForBiome(x, z, ablock, this.biomesForGeneration); Chunk chunk = new Chunk(this.worldObj, x, z); byte[] abyte = chunk.getBiomeArray(); for(int k = 0; k < abyte.length; k++) { abyte[k] = ((byte)this.biomesForGeneration[k].biomeID); } chunk.generateSkylightMap(); return chunk; } @Override public Chunk provideChunk(BlockPos blockPosIn) { return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); } @Override public void populate(IChunkProvider iChunkProvider, int i, int j) { BlockSand.fallInstantly = true; int var4 = i * 16; int var5 = j * 16; BiomeGenBase var6 = this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(var4 + 16, 0, var5 + 16)); this.rand.setSeed(this.worldObj.getSeed()); if(this.rand.nextInt(4) == 0) { int var13 = var4 + this.rand.nextInt(16) + 8; int var14 = this.rand.nextInt(256); int var15 = var5 + this.rand.nextInt(16) + 8; new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, new BlockPos(var13, var14, var15)); } Random rand = new Random(); int randomNum = rand.nextInt(6) + 1; if(randomNum == 2) { WorldGenTrees var17 = new WorldGenTrees(true); for(int var18 = 0; var18 < 5; var18++) { int var19 = var4 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var4 + 8; var21 < var4 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var4 + 8); var10000 = var20 - (var5 + 8); } } } else if(randomNum == 3) { WorldGenTrees var17 = new WorldGenTrees(false); for(int var18 = 0; var18 < 5; var18++) { int var19 = var4 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var4 + 8; var21 < var4 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var4 + 8); var10000 = var20 - (var5 + 8); } } } else if(randomNum == 4) { WorldGenBigTree var17 = new WorldGenBigTree(true); for(int var18 = 0; var18 < 5; var18++) { int var19 = var4 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var4 + 8; var21 < var4 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var4 + 8); var10000 = var20 - (var5 + 8); } } } BlockSand.fallInstantly = false; } @Override public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { return false; } @Override public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) { return true; } @Override public boolean unloadQueuedChunks() { return false; } @Override public boolean canSave() { return true; } @Override public String makeString() { return "RandomLevelSource"; } @Override public List func_177458_a(EnumCreatureType enumCreatureType, BlockPos pos) { BiomeGenDream biomegenbase = (BiomeGenDream)this.worldObj.getBiomeGenForCoords(pos); return biomegenbase.getSpawnableList(enumCreatureType); } @Override public BlockPos getStrongholdGen(World worldIn, String p_180513_2_, BlockPos p_180513_3_) { return null; } @Override public int getLoadedChunkCount() { return 0; } @Override public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) {} @Override public void saveExtraData() {} }
Mais c’est peut-être un problème au niveau du biome :
package mods.emotion.dimension; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BiomeGenDream extends BiomeGenBase { public BiomeGenDream(int par1) { super(par1); setTemperatureRainfall(0.0F, 0.0F); setHeight(height_LowPlains); this.theBiomeDecorator.treesPerChunk = 5; this.theBiomeDecorator.flowersPerChunk = 4; this.theBiomeDecorator.grassPerChunk = 10; } @Override public void genTerrainBlocks(World world, Random rand, ChunkPrimer chunkPrimer, int i, int j, double d1) { this.topBlock = Blocks.grass.getDefaultState(); this.fillerBlock = Blocks.dirt.getDefaultState(); this.generateEmotionBiomeTerrain(world, rand, chunkPrimer, i, j, d1); } public final void generateEmotionBiomeTerrain(World worldIn, Random p_180628_2_, ChunkPrimer p_180628_3_, int p_180628_4_, int p_180628_5_, double p_180628_6_) { boolean flag = true; IBlockState iblockstate = this.topBlock; IBlockState iblockstate1 = this.fillerBlock; int k = -1; int l = (int)(p_180628_6_ / 3.0D + 3.0D + p_180628_2_.nextDouble() * 0.25D); int i1 = p_180628_4_ & 15; int j1 = p_180628_5_ & 15; for(int k1 = 255; k1 >= 0; –k1) { if(k1 <= p_180628_2_.nextInt(5)) { p_180628_3_.setBlockState(j1, k1, i1, Blocks.air.getDefaultState()); } else { IBlockState iblockstate2 = p_180628_3_.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(p_180628_4_, k1, p_180628_5_)) < 0.15F) { iblockstate = Blocks.ice.getDefaultState(); } else { iblockstate = Blocks.water.getDefaultState(); } } k = l; if(k1 >= 62) { p_180628_3_.setBlockState(j1, k1, i1, iblockstate); } else if(k1 < 56 - l) { iblockstate = null; iblockstate1 = Blocks.stone.getDefaultState(); p_180628_3_.setBlockState(j1, k1, i1, Blocks.gravel.getDefaultState()); } else { p_180628_3_.setBlockState(j1, k1, i1, iblockstate1); } } else if(k > 0) { --k; p_180628_3_.setBlockState(j1, k1, i1, iblockstate1); if(k == 0 && iblockstate1.getBlock() == Blocks.sand) { k = p_180628_2_.nextInt(4) + Math.max(0, k1 - 63); iblockstate1 = Blocks.air.getDefaultState(); } } } } } } @SideOnly(Side.CLIENT) public int getGrassColorAtPos(BlockPos pos) { return 0xFF2bcda1; } @SideOnly(Side.CLIENT) public int getFoliageColorAtPos(BlockPos pos) { return 0xFF2bcda1; } }
Aucune erreur à perte de vue, juste une apparition brutale au beau millieux du vide total… En ésperant que quelqu’un trouve une solution, merci d’avance
-
Bon je sais pas réellement à combien de temps d’intervalle j’ai le droit de “up” mais je vais quand même me permette de le faire après 10h au cas ou quelqu’un de connaisseur passe par ici
[–— UP -----]
-
@‘robin4002’:
7. Le flood est interdit, il doit y avoir minimum 24h entre deux postes par la même personne. Si vous devez compléter un message et que personne n’a encore répondu, utilisez la fonction éditer.
-
Se sour je rentre chez moi. Je regarderai.
Envoyé de mon GT-S7390G
-
D’accord merci bien
-
le problème viens du chunk provider. tu as essayer en reprennent le CP du tuto et en l’adaptant.
-
Oui justement je me suis rendue compte que le problème venais effectivement de là, seul soucie c’est que certaine fonction n’existe plus en 1.8 et je ne vois pas comment “mieux” les réadapter
J’ai essayé ça :package mods.emotion.dimension; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.feature.WorldGenBigTree; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenTrees; public class SkyChunkProvider implements IChunkProvider { private Random rand; private NoiseGeneratorOctaves noiseGen1; private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorOctaves noiseGen4; public NoiseGeneratorOctaves noiseGen5; public NoiseGeneratorOctaves noiseGen6; private NoiseGeneratorOctaves noiseGen7; public NoiseGeneratorOctaves mobSpawnerNoise; private World worldObj; private double[] noiseArray; private double[] bNoise1; private double[] bNoise2; private double[] bNoise3; private BiomeGenBase[] biomesForGeneration; double[] noise1; double[] noise2; double[] noise3; double[] noise4; double[] noise5; int[][] field_914_i = new int[32][32]; private double[] generatedTemperatures; public Block topBlock; public Block fillerBlock; public SkyChunkProvider(World world, long seed) { this.bNoise1 = new double[256]; this.bNoise2 = new double[256]; this.bNoise3 = new double[256]; this.worldObj = world; this.rand = new Random(seed); this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 32); this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 64); this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 4); this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 10); this.noiseGen7 = new NoiseGeneratorOctaves(this.rand, 16); this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); } public void generateTerrain(int i, int j, IBlockState[] ablock, BiomeGenBase[] abiomes) { byte byte0 = 2; int k = byte0 + 1; byte byte1 = 33; int l = byte0 + 1; this.noiseArray = initializeNoiseField(this.noiseArray, i * byte0, 0, j * byte0, k, byte1, l); for(int i1 = 0; i1 < byte0; i1++) { for(int j1 = 0; j1 < byte0; j1++) { for(int k1 = 0; k1 < 32; k1++) { double d = 0.25D; double d1 = this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 0)]; double d2 = this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 0)]; double d3 = this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 0)]; double d4 = this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 0)]; double d5 = (this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 1)] - d1) * d; double d6 = (this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 1)] - d2) * d; double d7 = (this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 1)] - d3) * d; double d8 = (this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 1)] - d4) * d; for(int l1 = 0; l1 < 4; l1++) { double d9 = 0.125D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for(int i2 = 0; i2 < 8; i2++) { int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1; char c = ''; double d14 = 0.125D; double d15 = d10; double d16 = (d11 - d10) * d14; for(int k2 = 0; k2 < 8; k2++) { IBlockState l2 = Blocks.air.getDefaultState(); if(d15 > 0.0D) { l2 = Blocks.stone.getDefaultState(); } ablock[j2] = l2; j2 += c; d15 += d16; } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } private double[] initializeNoiseField(double[] ad, int i, int j, int k, int l, int i1, int j1) { if(ad == null) { ad = new double[l * i1 * j1]; } double d = 684.41200000000003D; double d1 = 684.41200000000003D; this.noise4 = this.noiseGen6.generateNoiseOctaves(this.noise4, i, k, l, j1, 1.121D, 1.121D, 0.5D); this.noise5 = this.noiseGen7.generateNoiseOctaves(this.noise5, i, k, l, j1, 200.0D, 200.0D, 0.5D); d *= 2.0D; this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, i, j, k, l, i1, j1, d / 80.0D, d1 / 160.0D, d / 80.0D); this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, i, j, k, l, i1, j1, d, d1, d); this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, i, j, k, l, i1, j1, d, d1, d); int k1 = 0; int l1 = 0; for(int j2 = 0; j2 < l; j2++) { for(int l2 = 0; l2 < j1; l2++) { double d4 = 1.0D; d4 *= d4; d4 *= d4; d4 = 1.0D - d4; double d5 = (this.noise4[l1] + 256.0D) / 512.0D; d5 *= d4; if(d5 > 1.0D) { d5 = 1.0D; } double d6 = this.noise5[l1] / 8000.0D; if(d6 < 0.0D) { d6 = -d6 * 0.3D; } d6 = d6 * 3.0D - 2.0D; if(d6 > 1.0D) { d6 = 1.0D; } d6 /= 8.0D; d6 = 0.0D; if(d5 < 0.0D) { d5 = 0.0D; } d5 += 0.5D; d6 = d6 * i1 / 16.0D; l1++; double d7 = i1 / 2.0D; for(int j3 = 0; j3 < i1; j3++) { double d8 = 0.0D; double d9 = (j3 - d7) * 8.0D / d5; if(d9 < 0.0D) { d9 *= -1.0D; } double d10 = this.noise1[k1] / 512.0D; double d11 = this.noise2[k1] / 512.0D; double d12 = (this.noise3[k1] / 10.0D + 1.0D) / 2.0D; if(d12 < 0.0D) { d8 = d10; } else if(d12 > 1.0D) { d8 = d11; } else { d8 = d10 + (d11 - d10) * d12; } d8 -= 8.0D; int k3 = 32; if(j3 > i1 - k3) { double d13 = (j3 - (i1 - k3)) / (k3 - 1.0F); d8 = d8 * (1.0D - d13) + -30.0D * d13; } k3 = 8; if(j3 < k3) { double d14 = (k3 - j3) / (k3 - 1.0F); d8 = d8 * (1.0D - d14) + -30.0D * d14; } ad[k1] = d8; k1++; } } } return ad; } public void replaceBlockForBiome(int i, int j, IBlockState[] block, BiomeGenBase[] abiome) { double d = 0.03125D; this.bNoise1 = this.noiseGen4.generateNoiseOctaves(this.bNoise1, i * 16, j * 16, 0, 16, 16, 1, d, d, 1.0D); this.bNoise2 = this.noiseGen4.generateNoiseOctaves(this.bNoise2, i * 16, 109, j * 16, 16, 1, 16, d, 1.0D, d); this.bNoise3 = this.noiseGen5.generateNoiseOctaves(this.bNoise3, i * 16, j * 16, 0, 16, 16, 1, d * 2.0D, d * 2.0D, d * 2.0D); for(int k = 0; k < 16; k++) { for(int l = 0; l < 16; l++) { int i1 = (int)(this.bNoise3[(k + l * 16)] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); int j1 = -1; this.topBlock = Blocks.grass; this.fillerBlock = Blocks.dirt; IBlockState block1 = this.topBlock.getDefaultState(); IBlockState block2 = this.fillerBlock.getDefaultState(); IBlockState stone = Blocks.stone.getDefaultState(); if(block1 == Blocks.air.getDefaultState()) { block1 = Blocks.grass.getDefaultState(); } if(block2 == Blocks.air.getDefaultState()) { block2 = Blocks.dirt.getDefaultState(); } if(stone == Blocks.air.getDefaultState()) { stone = Blocks.stone.getDefaultState(); } for(int k1 = 127; k1 >= 0; k1–) { int l1 = (l * 16 + k) * 128 + k1; IBlockState block3 = block[l1]; if(block3 == Blocks.air.getDefaultState()) { j1 = -1; } else if(block3 == stone) { if(j1 == -1) { if(i1 <= 0) { block1 = Blocks.air.getDefaultState(); block2 = stone; } j1 = i1; if(k1 >= 0) { block[l1] = block1; } else { block[l1] = block2; } } else if(j1 > 0) { j1–; block[l1] = block2; } } } } } } public List getPossibleCreatures(EnumCreatureType enumcreaturetype, int x, int y, int z) { BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(new BlockPos(x, y, z)); return var5 == null ? null : var5.getSpawnableList(enumcreaturetype); } @Override public boolean chunkExists(int x, int z) { return true; } @Override public Chunk provideChunk(BlockPos blockPosIn) { return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); } @Override public Chunk provideChunk(int x, int z) { this.rand.setSeed(x * 391279128714L + z * 132894987741L); IBlockState[] ablock = new IBlockState[32768]; this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); this.generateTerrain(x, z, ablock, this.biomesForGeneration); this.replaceBlockForBiome(x, z, ablock, this.biomesForGeneration); Chunk chunk = new Chunk(this.worldObj, x, z); byte[] abyte = chunk.getBiomeArray(); for(int k = 0; k < abyte.length; k++) { abyte[k] = ((byte)this.biomesForGeneration[k].biomeID); } chunk.generateSkylightMap(); return chunk; } @Override public void populate(IChunkProvider iChunkProvider, int i, int j) { BlockSand.fallInstantly = true; int var4 = i * 16; int var5 = j * 16; BiomeGenBase var6 = this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(var4 + 16, 0, var5 + 16)); this.rand.setSeed(this.worldObj.getSeed()); if(this.rand.nextInt(4) == 0) { int var13 = var4 + this.rand.nextInt(16) + 8; int var14 = this.rand.nextInt(256); int var15 = var5 + this.rand.nextInt(16) + 8; new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, new BlockPos(var13, var14, var15)); } Random rand = new Random(); int randomNum = rand.nextInt(6) + 1; if(randomNum == 2) { WorldGenTrees var17 = new WorldGenTrees(true); for(int var18 = 0; var18 < 5; var18++) { int var19 = var4 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var4 + 8; var21 < var4 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var4 + 8); var10000 = var20 - (var5 + 8); } } } else if(randomNum == 3) { WorldGenTrees var17 = new WorldGenTrees(false); for(int var18 = 0; var18 < 5; var18++) { int var19 = var4 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var4 + 8; var21 < var4 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var4 + 8); var10000 = var20 - (var5 + 8); } } } else if(randomNum == 4) { WorldGenBigTree var17 = new WorldGenBigTree(true); for(int var18 = 0; var18 < 5; var18++) { int var19 = var4 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var4 + 8; var21 < var4 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var4 + 8); var10000 = var20 - (var5 + 8); } } } BlockSand.fallInstantly = false; } @Override public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { return false; } @Override public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) { return true; } @Override public boolean unloadQueuedChunks() { return false; } @Override public boolean canSave() { return true; } @Override public String makeString() { return "RandomLevelSource"; } @Override public List func_177458_a(EnumCreatureType enumCreatureType, BlockPos pos) { BiomeGenDream biomegenbase = (BiomeGenDream)this.worldObj.getBiomeGenForCoords(pos); return biomegenbase.getSpawnableList(enumCreatureType); } @Override public BlockPos getStrongholdGen(World worldIn, String p_180513_2_, BlockPos p_180513_3_) { return null; } @Override public int getLoadedChunkCount() { return 0; } @Override public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) {} @Override public void saveExtraData() {} }
Mais c’est prévisible, ça ne fonctionne pas.
-
je vais développer chez toi l’esprit logique. Dit moi les fonctions qui n’existe plus et celle qui sont là mais qui ne l’étais pas.
-
Alors je vais sûrement devoir développer chez toi “l’envie de ponctuer tes phrases”.
public void generateTerrain(int i, int j, IBlockState[] ablock, BiomeGenBase[] abiomes){}
dans le ChunkProvider du Nether ce traduit par :
public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_){}
J’imagine donc que le problème commence ici.
-
Chez moi j’avais noté plus de fonction qui changer, mais sinon. Tu as chercher dans le CP (de l’overworld) de voir le but de la fonction ?
-
Bon j’ai tout refais, tout analysé et presque tout compris. Je ne vais peut-être pas répondre à ta question mais je pense pouvoir t’aider en te donnant ça, d’abord j’ai quelque erreurs ici (SkyChunkProvider):
BiomeGenBase var6 = this.worldObj.getWorldChunkManager().getBiomeGenAt(var4 + 16, var5 + 16);
int var21 = this.worldObj.getHeightValue(var19, var20);
“.getHeightValue” deviens simplement “.getHeight()” j’imagine mais pour “.getBiomeGenAt” si je rajoute les nouveaux paramètres à savoir (listToReuse, x, z, width, length, cacheFlag), “BiomeGenBase var6” passe en “BiomeGenBase[] var6” ce qui me pose quelque problème.
Ensuite du coté du biome (BiomeGenDream) je rencontre des problèmes avec la fonction cryptée qui à simplement disparue et je ne suis pas apte à trouver sont équivalent :
this.field_150604_aj = 0;
mais aussi avec “byte[] abyte” qui à disparue de la fonction :
public void genTerrainBlocks(World world, Random rand, ChunkPrimer chunkPrimer, int x, int z, double d1){}
Je revois ma nouvelle classe (avec en bonus mes doutes en commentaires) et une screenshoot de ce qui, me semble, être une avancée.
- SkyChunkProvider -
package mods.emotion.dimension; import java.util.List; import java.util.Random; import net.minecraft.block.BlockSand; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.feature.WorldGenBigTree; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenTrees; public class SkyChunkProvider implements IChunkProvider { private Random rand; private NoiseGeneratorOctaves noiseGen1; private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorOctaves noiseGen4; public NoiseGeneratorOctaves noiseGen5; public NoiseGeneratorOctaves noiseGen6; private NoiseGeneratorOctaves noiseGen7; public NoiseGeneratorOctaves mobSpawnerNoise; private World worldObj; private double[] noiseArray; private double[] bNoise1; private double[] bNoise2; private double[] bNoise3; private BiomeGenBase[] biomesForGeneration; double[] noise1; double[] noise2; double[] noise3; double[] noise4; double[] noise5; int[][] field_914_i = new int[32][32]; private double[] generatedTemperatures; public IBlockState topBlock; public IBlockState fillerBlock; public SkyChunkProvider(World world, long seed) { this.bNoise1 = new double[256]; this.bNoise2 = new double[256]; this.bNoise3 = new double[256]; this.worldObj = world; this.rand = new Random(seed); this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 32); this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 64); this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 4); this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 10); this.noiseGen7 = new NoiseGeneratorOctaves(this.rand, 16); this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); } //Dans cette fonction ci-dessous je doute de ma correcte utilisation de "chunkPrimer" public void generateTerrain(int i, int j, ChunkPrimer chunkPrimer, BiomeGenBase[] abiomes) { byte byte0 = 2; int k = byte0 + 1; byte byte1 = 33; int l = byte0 + 1; this.noiseArray = initializeNoiseField(this.noiseArray, i * byte0, 0, j * byte0, k, byte1, l); for(int i1 = 0; i1 < byte0; i1++) { for(int j1 = 0; j1 < byte0; j1++) { for(int k1 = 0; k1 < 32; k1++) { double d = 0.25D; double d1 = this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 0)]; double d2 = this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 0)]; double d3 = this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 0)]; double d4 = this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 0)]; double d5 = (this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 1)] - d1) * d; double d6 = (this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 1)] - d2) * d; double d7 = (this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 1)] - d3) * d; double d8 = (this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 1)] - d4) * d; for(int l1 = 0; l1 < 4; l1++) { double d9 = 0.125D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for(int i2 = 0; i2 < 8; i2++) { int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1; char c = ''; double d14 = 0.125D; double d15 = d10; double d16 = (d11 - d10) * d14; for(int k2 = 0; k2 < 8; k2++) { IBlockState l2 = Blocks.air.getDefaultState(); if(d15 > 0.0D) { l2 = Blocks.stone.getDefaultState(); } chunkPrimer.setBlockState(j2, l2); j2 += c; d15 += d16; } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } //Pareil pour cette fonction public void replaceBlocksForBiome(int i, int j, ChunkPrimer chunkPrimer, BiomeGenBase[] abiome) { double d = 0.03125D; this.bNoise1 = this.noiseGen4.generateNoiseOctaves(this.bNoise1, i * 16, j * 16, 0, 16, 16, 1, d, d, 1.0D); this.bNoise2 = this.noiseGen4.generateNoiseOctaves(this.bNoise2, i * 16, 109, j * 16, 16, 1, 16, d, 1.0D, d); this.bNoise3 = this.noiseGen5.generateNoiseOctaves(this.bNoise3, i * 16, j * 16, 0, 16, 16, 1, d * 2.0D, d * 2.0D, d * 2.0D); for(int k = 0; k < 16; k++) { for(int l = 0; l < 16; l++) { int i1 = (int)(this.bNoise3[(k + l * 16)] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); int j1 = -1; this.topBlock = Blocks.grass.getDefaultState(); this.fillerBlock = Blocks.dirt.getDefaultState(); IBlockState block1 = this.topBlock; IBlockState block2 = this.fillerBlock; IBlockState stone = Blocks.stone.getDefaultState(); if(block1 == Blocks.air) { block1 = Blocks.grass.getDefaultState(); } if(block2 == Blocks.air) { block2 = Blocks.dirt.getDefaultState(); } if(stone == Blocks.air) { stone = Blocks.stone.getDefaultState(); } for(int k1 = 127; k1 >= 0; k1–) { int l1 = (l * 16 + k) * 128 + k1; IBlockState block3 = chunkPrimer.getBlockState(l1); if(block3 == Blocks.air) { j1 = -1; } else if(block3 == stone) { if(j1 == -1) { if(i1 <= 0) { block1 = Blocks.air.getDefaultState(); block2 = stone; } j1 = i1; if(k1 >= 0) { chunkPrimer.setBlockState(l1, block1); } else { chunkPrimer.setBlockState(l1, block2); } } else if(j1 > 0) { j1--; chunkPrimer.setBlockState(l1, block2); } } } } } } private double[] initializeNoiseField(double[] ad, int i, int j, int k, int l, int i1, int j1) { if(ad == null) { ad = new double[l * i1 * j1]; } double d = 684.41200000000003D; double d1 = 684.41200000000003D; this.noise4 = this.noiseGen6.generateNoiseOctaves(this.noise4, i, k, l, j1, 1.121D, 1.121D, 0.5D); this.noise5 = this.noiseGen7.generateNoiseOctaves(this.noise5, i, k, l, j1, 200.0D, 200.0D, 0.5D); d *= 2.0D; this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, i, j, k, l, i1, j1, d / 80.0D, d1 / 160.0D, d / 80.0D); this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, i, j, k, l, i1, j1, d, d1, d); this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, i, j, k, l, i1, j1, d, d1, d); int k1 = 0; int l1 = 0; for(int j2 = 0; j2 < l; j2++) { for(int l2 = 0; l2 < j1; l2++) { double d4 = 1.0D; d4 *= d4; d4 *= d4; d4 = 1.0D - d4; double d5 = (this.noise4[l1] + 256.0D) / 512.0D; d5 *= d4; if(d5 > 1.0D) { d5 = 1.0D; } double d6 = this.noise5[l1] / 8000.0D; if(d6 < 0.0D) { d6 = -d6 * 0.3D; } d6 = d6 * 3.0D - 2.0D; if(d6 > 1.0D) { d6 = 1.0D; } d6 /= 8.0D; d6 = 0.0D; if(d5 < 0.0D) { d5 = 0.0D; } d5 += 0.5D; d6 = d6 * i1 / 16.0D; l1++; double d7 = i1 / 2.0D; for(int j3 = 0; j3 < i1; j3++) { double d8 = 0.0D; double d9 = (j3 - d7) * 8.0D / d5; if(d9 < 0.0D) { d9 *= -1.0D; } double d10 = this.noise1[k1] / 512.0D; double d11 = this.noise2[k1] / 512.0D; double d12 = (this.noise3[k1] / 10.0D + 1.0D) / 2.0D; if(d12 < 0.0D) { d8 = d10; } else if(d12 > 1.0D) { d8 = d11; } else { d8 = d10 + (d11 - d10) * d12; } d8 -= 8.0D; int k3 = 32; if(j3 > i1 - k3) { double d13 = (j3 - (i1 - k3)) / (k3 - 1.0F); d8 = d8 * (1.0D - d13) + -30.0D * d13; } k3 = 8; if(j3 < k3) { double d14 = (k3 - j3) / (k3 - 1.0F); d8 = d8 * (1.0D - d14) + -30.0D * d14; } ad[k1] = d8; k1++; } } } return ad; } @Override public boolean chunkExists(int x, int z) { return true; } @Override public Chunk provideChunk(int x, int z) { this.rand.setSeed(x * 391279128714L + z * 132894987741L); ChunkPrimer ablock = new ChunkPrimer(); this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); generateTerrain(x, z, ablock, this.biomesForGeneration); replaceBlocksForBiome(x, z, ablock, this.biomesForGeneration); Chunk chunk = new Chunk(this.worldObj, ablock, x, z); byte[] abyte = chunk.getBiomeArray(); for(int k = 0; k < abyte.length; k++) { abyte[k] = ((byte)this.biomesForGeneration[k].biomeID); } chunk.generateSkylightMap(); return chunk; } @Override public Chunk provideChunk(BlockPos pos) { return provideChunk(pos); } @Override public void populate(IChunkProvider chunkPrimer, int x, int z) { BlockSand.fallInstantly = true; int var2 = x * 16; int var3 = this.rand.nextInt(256); int var5 = z * 16; //Doute ici avec la fonction .getBiomeGenerator que j'utilise à la place de .getBiomeGenAt mais aussi de var3 BiomeGenBase var6 = this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(var2, var3, var5)); this.rand.setSeed(this.worldObj.getSeed()); if(this.rand.nextInt(4) == 0) { int var13 = var2 + this.rand.nextInt(16) + 8; int var14 = this.rand.nextInt(256); int var15 = var5 + this.rand.nextInt(16) + 8; new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, new BlockPos(var13, var14, var15)); } Random rand = new Random(); int randomNum = rand.nextInt(6) + 1; if(randomNum == 2) { WorldGenTrees var17 = new WorldGenTrees(true); for(int var18 = 0; var18 < 5; var18++) { int var19 = var2 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); //Doute ici aussi pour la fonction.getHeight qui ne demande plus de valeur x et z int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var2 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var2 + 8; var21 < var2 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var2 + 8); var10000 = var20 - (var5 + 8); } } } else if(randomNum == 3) { WorldGenTrees var17 = new WorldGenTrees(false); for(int var18 = 0; var18 < 5; var18++) { int var19 = var2 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); //Même doute int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var2 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var2 + 8; var21 < var2 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var2 + 8); var10000 = var20 - (var5 + 8); } } } else if(randomNum == 4) { WorldGenBigTree var17 = new WorldGenBigTree(true); for(int var18 = 0; var18 < 5; var18++) { int var19 = var2 + this.rand.nextInt(16); int var20 = var5 + this.rand.nextInt(16); //Idem int var21 = this.worldObj.getHeight(); var17.generate(this.worldObj, this.rand, new BlockPos(var19, var21, var20)); } SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var2 + 8, var5 + 8, 16, 16, this.rand); for(int var21 = var2 + 8; var21 < var2 + 8 + 16; var21++) { for(int var20 = var5 + 8; var20 < var5 + 8 + 16; var20++) { int var10000 = var21 - (var2 + 8); var10000 = var20 - (var5 + 8); } } } BlockSand.fallInstantly = false; } @Override public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { return false; } @Override public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) { return true; } @Override public boolean unloadQueuedChunks() { return false; } @Override public boolean canSave() { return true; } @Override public String makeString() { return "RandomLevelSource"; } @Override public List func_177458_a(EnumCreatureType enumcreaturetype, BlockPos pos) { BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(pos); return var5 == null ? null : var5.getSpawnableList(enumcreaturetype); } @Override public BlockPos getStrongholdGen(World worldIn, String p_180513_2_, BlockPos p_180513_3_) { return null; } @Override public int getLoadedChunkCount() { return 0; } @Override public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) {} @Override public void saveExtraData() {} }
- BiomeGenDream -
package mods.emotion.dimension; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BiomeGenDream extends BiomeGenBase { public BiomeGenDream(int par1) { super(par1); setTemperatureRainfall(0.0F, 0.0F); //Doute sur la hauteur max et min this.setHeight(new BiomeGenBase.Height(0.5F, 0.0F)); this.theBiomeDecorator.treesPerChunk = 5; this.theBiomeDecorator.flowersPerChunk = 4; this.theBiomeDecorator.grassPerChunk = 10; } @Override public void genTerrainBlocks(World world, Random rand, ChunkPrimer chunkPrimer, int x, int z, double d1) { this.topBlock = Blocks.grass.getDefaultState(); //Doute sur la suppression de la ligne this.field_150604_aj = 0; this.fillerBlock = Blocks.dirt.getDefaultState(); this.generateEmoBiomeTerrain(world, rand, chunkPrimer, x, z, d1); } //Doute sur l'utilisation correcte de chunkPrimer et des différentes modifications suite à la suppression de byte[] abyte public final void generateEmoBiomeTerrain(World world, Random rand, ChunkPrimer chunkPrimer, int x, int z, double d1) { boolean flag = true; IBlockState block = this.topBlock; byte b0 = (byte)(0 & 255); IBlockState block1 = this.fillerBlock; int k = -1; int l = (int)(d1 / 3.0D + 3.0D + rand.nextDouble() * 0.25D); int i1 = x & 0xF; int j1 = z & 0xF; for (int l1 = 255; l1 >= 0; l1–) { int i2 = (j1 * 16 + i1) * 0 + l1; if (l1 <= 94) { chunkPrimer.setBlockState(i2, Blocks.air.getDefaultState()); } else { IBlockState block2 = chunkPrimer.getBlockState(i2); if ((block2 != null) && (block2.getBlock().getMaterial() != Material.air)) { if (block2 == Blocks.stone.getDefaultState()) { if (k == -1) { if (l <= 0) { block = null; b0 = 0; block1 = Blocks.stone.getDefaultState(); } else if ((l1 >= 59) && (l1 <= 64)) { block = this.topBlock; b0 = (byte)(0 & 0xFF); block1 = this.fillerBlock; } if ((l1 < 63) && ((block == null) || (block.getBlock().getMaterial() == Material.air))) { if (getFloatTemperature(new BlockPos(x, l1, z)) < 0.15F) { block = Blocks.ice.getDefaultState(); } else { block = Blocks.water.getDefaultState(); } } k = l; if (l1 >= 62) { chunkPrimer.setBlockState(i2, block); } else if (l1 < 56 - l) { block = null; block1 = Blocks.stone.getDefaultState(); chunkPrimer.setBlockState(i2, Blocks.gravel.getDefaultState()); } else { chunkPrimer.setBlockState(i2, block1); } } else if (k > 0) { k--; chunkPrimer.setBlockState(i2, block1); if ((k == 0) && (block1 == Blocks.sand.getDefaultState())) { k = rand.nextInt(4) + Math.max(0, l1 - 63); block1 = Blocks.air.getDefaultState(); } } } } else { k = -1; } } } } @SideOnly(Side.CLIENT) public int getGrassColorAtPos(BlockPos pos) { return 0xFF2bcda1; } @SideOnly(Side.CLIENT) public int getFoliageColorAtPos(BlockPos pos) { return 0xFF2bcda1; } }
- Screenshoot -
-
Ton truc de BiomeGenBase var6… remplace le par : BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(blockpos.add(16, 0, 16));
this.field_150604_aj = 0; ==> supprime le.
Pour l’histoire du byte, supprime le.
-
Bon j’ai appliqué ce que tu m’a conseiller, j’ai fouillé un peu et je pense avoir trouvé la source du problème. Classe SkyChunkProvider fonction generateTerrain entre les commentaires en vert :
public void generateTerrain(int i, int j, ChunkPrimer chunkPrimer) { byte byte0 = 2; int k = byte0 + 1; byte byte1 = 33; int l = byte0 + 1; this.noiseArray = initializeNoiseField(this.noiseArray, i * byte0, 0, j * byte0, k, byte1, l); for(int i1 = 0; i1 < byte0; i1++) { for(int j1 = 0; j1 < byte0; j1++) { for(int k1 = 0; k1 < 32; k1++) { double d = 0.25D; double d1 = this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 0)]; double d2 = this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 0)]; double d3 = this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 0)]; double d4 = this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 0)]; double d5 = (this.noiseArray[(((i1 + 0) * l + j1 + 0) * byte1 + k1 + 1)] - d1) * d; double d6 = (this.noiseArray[(((i1 + 0) * l + j1 + 1) * byte1 + k1 + 1)] - d2) * d; double d7 = (this.noiseArray[(((i1 + 1) * l + j1 + 0) * byte1 + k1 + 1)] - d3) * d; double d8 = (this.noiseArray[(((i1 + 1) * l + j1 + 1) * byte1 + k1 + 1)] - d4) * d; //Problème entre ici for(int l1 = 0; l1 < 4; l1++) { double d9 = 0.125D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for(int i2 = 0; i2 < 8; i2++) { int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1; char c = ''; double d14 = 0.125D; double d15 = d10; double d16 = (d11 - d10) * d14; for(int k2 = 0; k2 < 8; k2++) { IBlockState l2 = Blocks.air.getDefaultState(); if(d15 > 0.0D) { l2 = Blocks.stone.getDefaultState(); } chunkPrimer.setBlockState(j2, l2); j2 += c; d15 += d16; } //Et ici d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } }
-
Bon j’ai appliqué ce que tu m’a conseillé et j’ai commencé à bidouiller le generateTerrain qui étais la source du problème, je l’ai remplacé par celui de l’end :
public void generateTerrain(int x, int z, ChunkPrimer chunkPrimer) { byte b0 = 2; int k = b0 + 1; byte b1 = 33; int l = b0 + 1; this.noiseArray = this.initializeNoiseField(this.noiseArray, x * b0, 0, z * b0, k, b1, l); for(int i1 = 0; i1 < b0; ++i1) { for(int j1 = 0; j1 < b0; ++j1) { for(int k1 = 0; k1 < 32; ++k1) { double d0 = 0.25D; double d1 = this.noiseArray[((i1 + 0) * l + j1 + 0) * b1 + k1 + 0]; double d2 = this.noiseArray[((i1 + 0) * l + j1 + 1) * b1 + k1 + 0]; double d3 = this.noiseArray[((i1 + 1) * l + j1 + 0) * b1 + k1 + 0]; double d4 = this.noiseArray[((i1 + 1) * l + j1 + 1) * b1 + k1 + 0]; double d5 = (this.noiseArray[((i1 + 0) * l + j1 + 0) * b1 + k1 + 1] - d1) * d0; double d6 = (this.noiseArray[((i1 + 0) * l + j1 + 1) * b1 + k1 + 1] - d2) * d0; double d7 = (this.noiseArray[((i1 + 1) * l + j1 + 0) * b1 + k1 + 1] - d3) * d0; double d8 = (this.noiseArray[((i1 + 1) * l + j1 + 1) * b1 + k1 + 1] - d4) * d0; for(int l1 = 0; l1 < 4; ++l1) { double d9 = 0.125D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for(int i2 = 0; i2 < 8; ++i2) { double d14 = 0.125D; double d15 = d10; double d16 = (d11 - d10) * d14; for(int j2 = 0; j2 < 8; ++j2) { IBlockState iblockstate = Blocks.air.getDefaultState(); if(d15 > 0.0D) { iblockstate = Blocks.stone.getDefaultState(); } int k2 = i2 + i1 * 8; int l2 = l1 + k1 * 4; int i3 = j2 + j1 * 8; chunkPrimer.setBlockState(k2, l2, i3, iblockstate); d15 += d16; } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } }
Après ça, l’herbe ne ce généré pas à la 1er couche sur la stone à chaque fois à 8 block d’alternative (mauvaise utilisation du chunkPrimer) :
public void replaceBlocksForBiome(int i, int j, ChunkPrimer chunkPrimer) { double d = 0.03125D; this.bNoise1 = this.noiseGen4.generateNoiseOctaves(this.bNoise1, i * 16, j * 16, 0, 16, 16, 1, d, d, 1.0D); this.bNoise2 = this.noiseGen4.generateNoiseOctaves(this.bNoise2, i * 16, 109, j * 16, 16, 1, 16, d, 1.0D, d); this.bNoise3 = this.noiseGen5.generateNoiseOctaves(this.bNoise3, i * 16, j * 16, 0, 16, 16, 1, d * 2.0D, d * 2.0D, d * 2.0D); for(int k = 0; k < 16; k++) { for(int l = 0; l < 16; l++) { int i1 = (int)(this.bNoise3[(k + l * 16)] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); int j1 = -1; this.topBlock = Blocks.grass.getDefaultState(); this.fillerBlock = Blocks.dirt.getDefaultState(); IBlockState block1 = this.topBlock; IBlockState block2 = this.fillerBlock; IBlockState stone = Blocks.stone.getDefaultState(); if(block1 == Blocks.air.getDefaultState()) { block1 = Blocks.grass.getDefaultState(); } if(block2 == Blocks.air.getDefaultState()) { block2 = Blocks.dirt.getDefaultState(); } if(stone == Blocks.air.getDefaultState()) { stone = Blocks.stone.getDefaultState(); } for(int k1 = 127; k1 >= 0; k1–) { IBlockState block3 = chunkPrimer.getBlockState(k, k1, l); if(block3 == Blocks.air.getDefaultState()) { j1 = -1; } else if(block3 == stone) { if(j1 == -1) { if(i1 <= 0) { block1 = Blocks.air.getDefaultState(); block2 = stone; } j1 = i1; if(k1 >= 0) { chunkPrimer.setBlockState(k, k1, l, block1); } else { chunkPrimer.setBlockState(k, k1, l, block2); } } else if(j1 > 0) { j1--; chunkPrimer.setBlockState(k, k1, l, block2); } } } } } }
Et finalement mon seul problème restant c’est la hauteur des îles qui ne dépasse pas la couche 80 environ, la fréquence des îles et la
génération d’arbre etc… Qui ne ce génère pas du tout.J’ai réglé mon problème de génération avec ça :
public void populate(IChunkProvider chunkPrimer, int x, int z) { BlockSand.fallInstantly = true; int var2 = x * 16; int var5 = z * 16; BlockPos blockpos = new BlockPos(var2, 0, var5); BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(new BlockPos(16, 0, 16)); this.rand.setSeed(this.worldObj.getSeed()); if(this.rand.nextInt(4) == 0) { int var13 = var2 + this.rand.nextInt(16) + 8; int var14 = this.rand.nextInt(256); int var15 = var5 + this.rand.nextInt(16) + 8; new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, new BlockPos(var13, var14, var15)); } biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(var2, 0, var5)); BlockSand.fallInstantly = false; }
-
Ton problème est réglé ?
-
J’aurais juste voulue savoir si t’avais une astuce pour augmenter la fréquence des îles et la hauteur min/max ou changer la couleur noir du vide à partir de la couche 60.
-
Bonjour, dans ma dimension qui est un desert je n’ai pas de bedrock, donc quand je creuse jusqu’à la couche 0 tout le sable de ma dimension tombe et donc créer un énorme freez.
edit:
En bidouillant j’ai trouver avec la fonction provideChunk je fais ça et ça marche :):
int i2 = 256; for(int i=0;i<256;i++) { int ia = i2*i; ablock[ia] = Blocks.bedrock; }