Non résolu [1.7.10] Ajout d'une dimension : Exception ticking world
-
Bien le bonjour !
J’ai suivi le tutoriel de Diangle,
||https://www.minecraftforgefrance.fr/topic/990/ajouter-une-nouvelle-dimension||
j’ai essayer de crée une dimension Skyland, mais quand je crée un monde , le jeu crash en m’indiquant cette erreur (console eclipse : https://hastebin.com/suxigolefa.sql).
Crash-reports : (Bizarrement, le crash report s’appelle : date-server) https://hastebin.com/asecovonek.sql
Voici mes classes :
SkyChunkProvider :package com.mod.landoria.world; import java.util.List; import java.util.Random; import com.mod.landoria.biomes.BiomeLando; import com.mod.landoria.init.BlockLandoria; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.ChunkPosition; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.Teleporter; 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(Object worldObj2, Object worldObj3) { // TODO Auto-generated constructor stub } public void SkyChunkProvider(World world, long seed) { //nous initialisons des fields 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 replaceBlocksForBiome(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 Chunk provideChunk(int par1, int par2) { this.rand.setSeed(par1 * 391279128714L + par2 * 132894987741L); Block[] ablock = new Block[32768]; this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); generateTerrain(par1, par2, ablock, this.biomesForGeneration); replaceBlocksForBiome(par1, par2, ablock, this.biomesForGeneration); Chunk chunk = new Chunk(this.worldObj, ablock, par1, par2); byte[] abyte = chunk.getBiomeArray(); for(int k = 0; k < abyte.length; k++) { abyte[k] = ((byte)this.biomesForGeneration[k].biomeID); } chunk.generateSkylightMap(); return chunk; } 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().getBiomeGenAt(var4 + 16, 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, 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.getHeightValue(var19, var20); var17.generate(this.worldObj, this.rand, 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.getHeightValue(var19, var20); var17.generate(this.worldObj, this.rand, 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.getHeightValue(var19, var20); var17.generate(this.worldObj, this.rand, 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; } public List getPossibleCreatures(EnumCreatureType enumcreaturetype, int i, int j, int k) { BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(i, k); return var5 == null ? null : var5.getSpawnableList(enumcreaturetype); } public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { return true; } public boolean unloadQueuedChunks() { return false; } public boolean canSave() { return true; } public String makeString() { return "RandomLevelSource"; } public ChunkPosition func_147416_a(World world, String s, int i, int j, int k) { return null; } public int getLoadedChunkCount() { return 0; } public boolean chunkExists(int i, int j) { return true; } public Chunk loadChunk(int i, int j) { return provideChunk(i, j); } public void recreateStructures(int i, int j) {} public void saveExtraData() { } }
SkyWorldProvider :
package com.mod.landoria.world; import java.util.List; import java.util.Random; import com.mod.landoria.Landoria; import com.mod.landoria.biomes.BiomeLando; import com.mod.landoria.init.BlockLandoria; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.Vec3; import net.minecraft.world.ChunkPosition; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManagerHell; 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 SkyWorldProvider extends WorldProvider implements IChunkProvider { private Object worldObj; private WorldChunkManagerHell worldChunkMgr; private int dimensionId; public String getDimensionName() { return "Landoria"; } public IChunkProvider createChunkGenerator() { return new SkyChunkProvider(this.worldObj,this.worldObj); } public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerHell(BiomeLando.landoriaPlains,1.0F); this.dimensionId = Landoria.dimLandoria; } public float getCloudHeight() { return 128.0F; } public boolean canRespawnHere() { return false; } public float calculateCelestialAngle(long var1, float var3) { return 0.0F; } public String getSaveFolder() { return "LandoriaDIM"; } public boolean isSurfaceWorld() { return false; } public boolean canCoordinateBeSpawn(int par1, int par2) { return ((World) this.worldObj).getTopBlock(par1, par2) == BlockLandoria.grass_landorithe; } @SideOnly(Side.CLIENT) public boolean isSkyColored() { return true; } @Override public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) return Vec3.createVectorHelper(95, 48, 25); } public String getDepartMessage() { if(this instanceof SkyWorldProvider) { return "Tu quittes la dimension de Landoria."; } return null; } public String getWelcomeMessage() { if(this instanceof SkyWorldProvider) { return "Tu entres dans la dimension de Landoria"; } return null; } @Override public boolean chunkExists(int p_73149_1_, int p_73149_2_) { return false; } @Override public Chunk provideChunk(int p_73154_1_, int p_73154_2_) { return null; } @Override public Chunk loadChunk(int p_73158_1_, int p_73158_2_) { return null; } @Override public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { } @Override public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) { // TODO Auto-generated method stub return false; } @Override public boolean unloadQueuedChunks() { return false; } @Override public boolean canSave() { return false; } @Override public String makeString() { return null; } @Override public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) { return null; } @Override public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) { return null; } @Override public int getLoadedChunkCount() { return 0; } @Override public void recreateStructures(int p_82695_1_, int p_82695_2_) { } @Override public void saveExtraData() { } }
SkyGenLayer :
package com.mod.landoria.world; import com.mod.landoria.biomes.SkyGenLayerBiome; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayerVoronoiZoom; import net.minecraft.world.gen.layer.GenLayerZoom; public abstract class SkyGenLayer extends GenLayer { public SkyGenLayer(long par1) { super(par1); } public static GenLayer[] makeTheWorld(long l) { GenLayer biomes = new SkyGenLayerBiome(1L); biomes = new GenLayerZoom(1000L, biomes); biomes = new GenLayerZoom(1001L, biomes); biomes = new GenLayerZoom(1002L, biomes); biomes = new GenLayerZoom(1003L, biomes); biomes = new GenLayerZoom(1004L, biomes); biomes = new GenLayerZoom(1005L, biomes); GenLayer genlayervoronoizoom = new GenLayerVoronoiZoom(10L, biomes); biomes.initWorldGenSeed(l); genlayervoronoizoom.initWorldGenSeed(l); return new GenLayer[] {biomes, genlayervoronoizoom}; } }
SkyTeleporter :
import java.util.ArrayList; import java.util.List; import java.util.Random; import com.mod.landoria.blocks.BlockPortail; import com.mod.landoria.init.BlockLandoria; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.Direction; import net.minecraft.util.LongHashMap; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.Teleporter; import net.minecraft.world.WorldServer; public class SkyTeleporter extends Teleporter { private final WorldServer worldServerInstance; private final Random random; private final LongHashMap destinationCoordinateCache = new LongHashMap(); private final List destinationCoordinateKeys = new ArrayList(); public SkyTeleporter(WorldServer worldServer) { super(worldServer); this.worldServerInstance = worldServer; this.random = new Random(worldServer.getSeed()); } public void placeInPortal(Entity entity, double x, double y, double z, float rotationYaw) { if(this.worldServerInstance.provider.dimensionId != 1) { if(!this.placeInExistingPortal(entity, x, y, z, rotationYaw)) { this.makePortal(entity); this.placeInExistingPortal(entity, x, y, z, rotationYaw); } else { int i = MathHelper.floor_double(entity.posX);//position x int j = MathHelper.floor_double(entity.posY) - 1;//position y int k = MathHelper.floor_double(entity.posZ);//position z byte b0 = 1; byte b1 = 0; for(int l = -2; l <= 2; ++l) { for(int i1 = -2; i1 <= 2; ++i1) { for(int j1 = -1; j1 < 3; ++j1) { int k1 = i + i1 * b0 + l * b1; int l1 = j + j1; int i2 = k + i1 * b1 - l * b0; boolean flag = j1 < 0; //set la structure this.worldServerInstance.setBlock(k1, l1, i2, flag ? Blocks.stone : Blocks.air); } } } entity.setLocationAndAngles((double)i, (double)j, (double)k, entity.rotationYaw, 0.0F); entity.motionX = entity.motionY = entity.motionZ = 0.0D; } } } public boolean placeInExistingPortal(Entity entity, double x, double y, double z, float rotationYaw) { short short1 = 128; double d3 = -1.0D; int i = 0; int j = 0; int k = 0; int l = MathHelper.floor_double(entity.posX);// position x int i1 = MathHelper.floor_double(entity.posZ);// position z long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);// convertit en un nombre // entier pour le hach boolean flag = true; double d4; int k1; if( this.destinationCoordinateCache.containsItem(j1)); { PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(j1); d3 = 0.0D; i = portalposition.posX;// position x j = portalposition.posY;// position y k = portalposition.posZ;// position z portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); flag = false; } { for(k1 = l - short1; k1 <= l + short1; ++k1) { double d5 = (double)k1 + 0.5D - entity.posX; for(int l1 = i1 - short1; l1 <= i1 + short1; ++l1) { double d6 = (double)l1 + 0.5D - entity.posZ; // renvoie a la hauteur du monde for(int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) { if(this.worldServerInstance.getBlock(k1, i2, l1) == BlockLandoria.portail_lando) { while(this.worldServerInstance.getBlock(k1, i2 - 1, l1) == BlockLandoria.portail_lando) { --i2; } d4 = (double)i2 + 0.5D - entity.posY; double d7 = d5 * d5 + d4 * d4 + d6 * d6; if(d3 < 0.0D || d7 < d3) { d3 = d7; i = k1; j = i2; k = l1; } } } } } } if(d3 >= 0.0D) { if(flag) { // ajoute des valeurs au LongHashMap this.destinationCoordinateCache.add(j1, new TutoPortalPosition(this, i, j, k, this.worldServerInstance.getTotalWorldTime())); this.destinationCoordinateKeys.add(Long.valueOf(j1)); } double d8 = (double)i + 0.5D; double d9 = (double)j + 0.5D; d4 = (double)k + 0.5D; int j2 = -1; if(this.worldServerInstance.getBlock(i - 1, j, k) == BlockLandoria.portail_lando) { j2 = 2; } if(this.worldServerInstance.getBlock(i + 1, j, k) == BlockLandoria.portail_lando) { j2 = 0; } if(this.worldServerInstance.getBlock(i, j, k - 1) == BlockLandoria.portail_lando) { j2 = 3; } if(this.worldServerInstance.getBlock(i, j, k + 1) == BlockLandoria.portail_lando) { j2 = 1; } int k2 = entity.getTeleportDirection(); if(j2 > -1) { // la position de l'entité dans le monde après avoir passer le // portail int l2 = Direction.rotateLeft[j2]; int i3 = Direction.offsetX[j2]; int j3 = Direction.offsetZ[j2]; int k3 = Direction.offsetX[l2]; int l3 = Direction.offsetZ[l2]; boolean flag1 = !this.worldServerInstance.isAirBlock(i + i3 + k3, j, k + j3 + l3) || !this.worldServerInstance.isAirBlock(i + i3 + k3, j + 1, k + j3 + l3); boolean flag2 = !this.worldServerInstance.isAirBlock(i + i3, j, k + j3) || !this.worldServerInstance.isAirBlock(i + i3, j + 1, k + j3); if(flag1 && flag2) { j2 = Direction.rotateOpposite[j2]; l2 = Direction.rotateOpposite[l2]; i3 = Direction.offsetX[j2]; j3 = Direction.offsetZ[j2]; k3 = Direction.offsetX[l2]; l3 = Direction.offsetZ[l2]; k1 = i - k3; d8 -= (double)k3; int i4 = k - l3; d4 -= (double)l3; flag1 = !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j, i4 + j3 + l3) || !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j + 1, i4 + j3 + l3); flag2 = !this.worldServerInstance.isAirBlock(k1 + i3, j, i4 + j3) || !this.worldServerInstance.isAirBlock(k1 + i3, j + 1, i4 + j3); } float f1 = 0.5F; float f2 = 0.5F; if(!flag1 && flag2) { f1 = 1.0F; } else if(flag1 && !flag2) { f1 = 0.0F; } else if(flag1 && flag2) { f2 = 0.0F; } d8 += (double)((float)k3 * f1 + f2 * (float)i3); d4 += (double)((float)l3 * f1 + f2 * (float)j3); float f3 = 0.0F; float f4 = 0.0F; float f5 = 0.0F; float f6 = 0.0F; if(j2 == k2) { f3 = 1.0F; f4 = 1.0F; } else if(j2 == Direction.rotateOpposite[k2]) { f3 = -1.0F; f4 = -1.0F; } else if(j2 == Direction.rotateRight[k2]) { f5 = 1.0F; f6 = -1.0F; } else { f5 = -1.0F; f6 = 1.0F; } double d10 = entity.motionX; double d11 = entity.motionZ; entity.motionX = d10 * (double)f3 + d11 * (double)f6; entity.motionZ = d10 * (double)f5 + d11 * (double)f4; entity.rotationYaw = rotationYaw - (float)(k2 * 90) + (float)(j2 * 90); } else { entity.motionX = entity.motionY = entity.motionZ = 0.0D; } entity.setLocationAndAngles(d8, d9, d4, entity.rotationYaw, entity.rotationPitch); return true; } else { return false; } } public boolean makePortal(Entity entity) { byte b0 = 16; double d0 = -1.0D; int x = MathHelper.floor_double(entity.posX);// position x int y = MathHelper.floor_double(entity.posY);// position y int z = MathHelper.floor_double(entity.posZ);// position z int l = x; int i1 = y; int j1 = z; int k1 = 0; int l1 = this.random.nextInt(4); int i2; double d1; int k2; double d2; int i3; int j3; int k3; int l3; int i4; int j4; int k4; int l4; int i5; double d3; double d4; for(i2 = x - b0; i2 <= x + b0; ++i2) { d1 = (double)i2 + 0.5D - entity.posX; for(k2 = z - b0; k2 <= z + b0; ++k2) { d2 = (double)k2 + 0.5D - entity.posZ; label274: for(i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { // si le blocs et un bloc d'air if(this.worldServerInstance.isAirBlock(i2, i3, k2)) { while(i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { --i3; } for(j3 = l1; j3 < l1 + 4; ++j3) { k3 = j3 % 2; l3 = 1 - k3; if(j3 % 4 >= 2) { k3 = -k3; l3 = -l3; } for(i4 = 0; i4 < 3; ++i4) { for(j4 = 0; j4 < 4; ++j4) { for(k4 = -1; k4 < 4; ++k4) { l4 = i2 + (j4 - 1) * k3 + i4 * l3; i5 = i3 + k4; int j5 = k2 + (j4 - 1) * l3 - i4 * k3; // si k4 et inférieur a 0 et que le // blocs n'est pas solide ou si k4 et // égale ou inférieur a 0 et que le bloc // est pas d'air nous retournons ou // label274 plus haut if(k4 < 0 && !this.worldServerInstance.getBlock(l4, i5, j5).getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(l4, i5, j5)) { continue label274; } } } } d3 = (double)i3 + 0.5D - entity.posY; d4 = d1 * d1 + d3 * d3 + d2 * d2; if(d0 < 0.0D || d4 < d0) { d0 = d4; l = i2; i1 = i3; j1 = k2; k1 = j3 % 4; } } } } } } if(d0 < 0.0D) { for(i2 = x - b0; i2 <= x + b0; ++i2) { d1 = (double)i2 + 0.5D - entity.posX; for(k2 = z - b0; k2 <= z + b0; ++k2) { d2 = (double)k2 + 0.5D - entity.posZ; label222: for(i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { if(this.worldServerInstance.isAirBlock(i2, i3, k2)) { while(i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { --i3; } for(j3 = l1; j3 < l1 + 2; ++j3) { k3 = j3 % 2; l3 = 1 - k3; for(i4 = 0; i4 < 4; ++i4) { for(j4 = -1; j4 < 4; ++j4) { k4 = i2 + (i4 - 1) * k3; l4 = i3 + j4; i5 = k2 + (i4 - 1) * l3; // si k4 et inférieur a 0 et que le // blocs n'est pas solide ou si k4 et // égale ou inférieur a 0 et que le bloc // est pas d'air nous retournons ou // label222 plus haut if(j4 < 0 && !this.worldServerInstance.getBlock(k4, l4, i5).getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, l4, i5)) { continue label222; } } } d3 = (double)i3 + 0.5D - entity.posY; d4 = d1 * d1 + d3 * d3 + d2 * d2; if(d0 < 0.0D || d4 < d0) { d0 = d4; l = i2; i1 = i3; j1 = k2; k1 = j3 % 2; } } } } } } } int k5 = l; int j2 = i1; k2 = j1; int l5 = k1 % 2; int l2 = 1 - l5; if(k1 % 4 >= 2) { l5 = -l5; l2 = -l2; } boolean flag; if(d0 < 0.0D) { if(i1 < 70) { i1 = 70; } if(i1 > this.worldServerInstance.getActualHeight() - 10) { i1 = this.worldServerInstance.getActualHeight() - 10; } j2 = i1; for(i3 = -1; i3 <= 1; ++i3) { for(j3 = 1; j3 < 3; ++j3) { for(k3 = -1; k3 < 3; ++k3) { l3 = k5 + (j3 - 1) * l5 + i3 * l2; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2 - i3 * l5; flag = k3 < 0; // permet de set des blocs de stone et air au bonne // endroit this.worldServerInstance.setBlock(l3, i4, j4, flag ? BlockLandoria.landorithe_block: Blocks.air); } } } } for(i3 = 0; i3 < 4; ++i3) { for(j3 = 0; j3 < 4; ++j3) { for(k3 = -1; k3 < 4; ++k3) { l3 = k5 + (j3 - 1) * l5; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2; flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3; // permet de set des blocs de stone et portail au bonne // endroit this.worldServerInstance.setBlock(l3, i4, j4, (flag ? BlockLandoria.landorithe_block : BlockLandoria.portail_lando), 0, 2); } } for(j3 = 0; j3 < 4; ++j3) { for(k3 = -1; k3 < 4; ++k3) { l3 = k5 + (j3 - 1) * l5; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2; this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4)); } } } return true; } class TutoPortalPosition extends ChunkCoordinates { public long time; final SkyTeleporter teleporter; public TutoPortalPosition(SkyTeleporter teleporter, int x, int y, int z, long creationTime) { super(x, y, z); this.teleporter = teleporter; this.time = creationTime; } @Override public int compareTo(Object o) { return 0; } } }
Dans ma classe principale :
public static int dimLandoria = 2; @EventHandler public void postInit(FMLPostInitializationEvent event) { DimensionManager.registerProviderType(Landoria.dimLandoria, SkyWorldProvider.class, false); DimensionManager.registerDimension(Landoria.dimLandoria,Landoria.dimLandoria); }
Je sais, ça fais beaucoup de code… Bon courage à celui qui aura la foi de tout lire ^^'.
Je vous remercie d’avance.
EDIT : Quand je retire le code dans PostInit pour enregistrer la dimension, ca fonctionne, donc c’est bel et bien un problème dans la dimension (je pense).