Mettre à jour une dimension
-
Un petit up pour mon problème de dimension. J’ai encore cherché, mais rien trouvé
-
tu utilise bien la classe de ton biome dans le chunk provider ?
edit : fait gaffe à la convention java. Regarde avec ce code :
package This_is_Halloween.Frightful; import static net.minecraft.world.biome.BiomeGenBase.forest; import static net.minecraft.world.biome.BiomeGenBase.forestHills; import static net.minecraft.world.biome.BiomeGenBase.jungle; import static net.minecraft.world.biome.BiomeGenBase.jungleHills; import static net.minecraft.world.biome.BiomeGenBase.plains; import static net.minecraft.world.biome.BiomeGenBase.taiga; import static net.minecraft.world.biome.BiomeGenBase.taigaHills; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import com.google.common.collect.Lists; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.util.BlockPos; import net.minecraft.util.ReportedException; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.WorldTypeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class WorldChunkManagerFrightful extends WorldChunkManager { private GenLayer GenBiomes; private GenLayer BiomeIndexLayer; private BiomeCache BiomeCache; private List <biomegenbase>BiomesToSpawnIn; public WorldChunkManagerFrightful() { this.BiomeCache = new BiomeCache(this); this.BiomesToSpawnIn = new ArrayList<biomegenbase>(); this.BiomesToSpawnIn.add(This_is_Halloween.This_is_Halloween.Evilland); } public WorldChunkManagerFrightful(long seed, WorldType worldtype, String string) { this(); GenLayer[] agenlayer = GenLayerFrightful.makeTheWorld(seed); this.GenBiomes = agenlayer[0]; this.BiomeIndexLayer = agenlayer[1]; } public WorldChunkManagerFrightful(World world) { this(world.getSeed(), world.getWorldInfo().getTerrainType()); } public List <biomegenbase>getBiomesToSpawnIn() { return this.BiomesToSpawnIn; } public BiomeGenBase getBiomeGenAt(int x, int z) { BiomeGenBase biome = this.BiomeCache.func_180284_a(x, z, BiomeGenBase); if(biome == null) { return This_is_Halloween.This_is_Halloween.Evilland; } return biome; } public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) { if(listToReuse == null || listToReuse.length < width * length) { listToReuse = new float[width * length]; } Arrays.fill(listToReuse, 0, width * length, 0.0F); return listToReuse; } @SideOnly(Side.CLIENT) public float getTemperatureAtHeight(float par1, int par2) { return par1; } public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } int[] aint = this.GenBiomes.getInts(par2, par3, par4, par5); for(int i = 0; i < par4 * par5; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = TaClass.tonBiome. } } return par1ArrayOfBiomeGenBase; } public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) { return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true); } public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); if (listToReuse == null || listToReuse.length < width * length) { listToReuse = new BiomeGenBase[width * length]; } if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) { BiomeGenBase[] abiomegenbase1 = this.BiomeCache.getCachedBiomes(x, z); System.arraycopy(abiomegenbase1, 0, listToReuse, 0, width * length); return listToReuse; } else { int[] aint = this.BiomeIndexLayer.getInts(x, z, width, length); for(int i1 = 0; i1 < width * length; ++i1) { if(aint[i1] >= 0) { listToReuse[i1] = BiomeGenBase.getBiome(aint[i1]); } else { listToReuse[i1] = TaClass.tonBiome; } } return listToReuse; } } public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); for(int j2 = 0; j2 < l1 * i2; ++j2) { BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]); if(!par4List.contains(biomegenbase)) { return false; } } return true; } public BlockPos findBiomePosition(int x, int z, int range, List list, Random random) { IntCache.resetIntCache(); int l = x - range >> 2; int i1 = z - range >> 2; int j1 = x + range >> 2; int k1 = z + range >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); BlockPos blockpos = null; int j2 = 0; for(int k2 = 0; k2 < l1 * i2; ++k2) { int l2 = l + k2 % l1 << 2; int i3 = i1 + k2 / l1 << 2; BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]); if(biomes.contains(biomegenbase) && (blockpos == null || random.nextInt(j2 + 1) == 0)) { blockpos = new BlockPos(l2, 0, i3); ++j2; } } return blockpos; } public void cleanupCache() { this.BiomeCache.cleanupCache(); } }regarde avec ce code. Il peut y avoir des erreus (pas importante mais…), j’ai utilisé un simple éditeur de texte.</biomegenbase></biomegenbase></biomegenbase>
-
Toujours la même erreur, je ne comprend pas :
[14:03:41] [Server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: net.minecraft.util.ReportedException: Exception generating new chunk java.util.concurrent.ExecutionException: net.minecraft.util.ReportedException: Exception generating new chunk at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_51] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_51] Caused by: net.minecraft.util.ReportedException: Exception generating new chunk at net.minecraft.entity.Entity.moveEntity(Entity.java:857) ~[Entity.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:381) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:36) ~[C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition.processPacket(C03PacketPlayer.java:154) ~[C03PacketPlayer$C04PacketPlayerPosition.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_51] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 5 more Caused by: java.lang.NullPointerException at This_is_Halloween.Frightful.WorldChunkManagerFrightful.getBiomesForGeneration(WorldChunkManagerFrightful.java:101) ~[WorldChunkManagerFrightful.class:?] at This_is_Halloween.Frightful.ChunkProviderFrightful.setBlocksInChunk(ChunkProviderFrightful.java:202) ~[ChunkProviderFrightful.class:?] at This_is_Halloween.Frightful.ChunkProviderFrightful.provideChunk(ChunkProviderFrightful.java:184) ~[ChunkProviderFrightful.class:?] at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:178) ~[ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:138) ~[ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:108) ~[ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:209) ~[ChunkProviderServer.class:?] at net.minecraft.world.World.getChunkFromChunkCoords(World.java:360) ~[World.class:?] at net.minecraft.world.World.getChunkFromBlockCoords(World.java:349) ~[World.class:?] at net.minecraft.world.World.getBlockState(World.java:902) ~[World.class:?] at This_is_Halloween.Frightful.TeleporterFrightful.placeInExistingPortal(TeleporterFrightful.java:113) ~[TeleporterFrightful.class:?] at This_is_Halloween.Frightful.TeleporterFrightful.placeInPortal(TeleporterFrightful.java:47) ~[TeleporterFrightful.class:?] at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:670) ~[ServerConfigurationManager.class:?] at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:576) ~[ServerConfigurationManager.class:?] at This_is_Halloween.Block.BlockPortalFrightful.onEntityCollidedWithBlock(BlockPortalFrightful.java:225) ~[BlockPortalFrightful.class:?] at net.minecraft.entity.Entity.doBlockCollisions(Entity.java:924) ~[Entity.class:?] at net.minecraft.entity.Entity.moveEntity(Entity.java:850) ~[Entity.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:381) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:36) ~[C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition.processPacket(C03PacketPlayer.java:154) ~[C03PacketPlayer$C04PacketPlayerPosition.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_51] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 5 more [14:03:42] [Server thread/INFO]: Stopping server [14:03:42] [Server thread/INFO]: Saving players [14:03:42] [Server thread/INFO]: Saving worlds [14:03:42] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [14:03:42] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [14:03:42] [Server thread/INFO]: Saving chunks for level 'New World'/The End [14:03:42] [Server thread/INFO]: Saving chunks for level 'New World'/Frightful [14:03:42] [Server thread/INFO] [FML]: Unloading dimension 0 [14:03:42] [Server thread/INFO] [FML]: Unloading dimension -1 [14:03:42] [Server thread/INFO] [FML]: Unloading dimension 1 [14:03:42] [Server thread/INFO] [FML]: Unloading dimension -5 [14:03:42] [Server thread/INFO] [FML]: Applying holder lookups [14:03:42] [Server thread/INFO] [FML]: Holder lookups applied [14:03:42] [Client thread/FATAL]: Reported exception thrown! net.minecraft.util.ReportedException: Getting biome at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:210) ~[World.class:?] at net.minecraft.world.WorldProvider.getBiomeGenForCoords(WorldProvider.java:429) ~[WorldProvider.class:?] at net.minecraft.world.World.getBiomeGenForCoords(World.java:185) ~[World.class:?] at net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(ForgeHooksClient.java:388) ~[ForgeHooksClient.class:?] at net.minecraft.world.World.getSkyColorBody(World.java:1531) ~[World.class:?] at net.minecraft.world.WorldProvider.getSkyColor(WorldProvider.java:463) ~[WorldProvider.class:?] at net.minecraft.world.World.getSkyColor(World.java:1518) ~[World.class:?] at net.minecraft.client.renderer.EntityRenderer.updateFogColor(EntityRenderer.java:1757) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1277) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1115) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] Caused by: java.lang.NullPointerException at This_is_Halloween.Frightful.WorldChunkManagerFrightful.getBiomeGenAt(WorldChunkManagerFrightful.java:141) ~[WorldChunkManagerFrightful.class:?] at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:106) ~[BiomeCache$Block.class:?] at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:37) ~[BiomeCache.class:?] at net.minecraft.world.biome.BiomeCache.func_180284_a(BiomeCache.java:48) ~[BiomeCache.class:?] at net.minecraft.world.biome.WorldChunkManager.func_180300_a(WorldChunkManager.java:75) ~[WorldChunkManager.class:?] at net.minecraft.world.chunk.Chunk.getBiome(Chunk.java:1442) ~[Chunk.class:?] at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:196) ~[World.class:?] … 21 moreJe tiens aussi à préciser (peut être rien avoir mais …) que le chunkProvider n’utilisait pas mon biome. J’ai donc ajouté ce code :
**[size=smallpublic]** **[size=smallvoid]** replaceBlocksForBiome(**[size=smallint]** [size=smallcoordX], **[size=smallint]** [size=smallcoordZ], ChunkPrimer [size=smallchunkprimer], **[size=smallbyte]**[] [size=smallarrayOfByte], BiomeGenBase[] [size=smallbiomeList]) { World [size=smallworld] = **[size=smallnull]**; ChunkProviderEvent.ReplaceBiomeBlocks [size=smallevent] = **[size=smallnew]** ChunkProviderEvent.ReplaceBiomeBlocks(**[size=smallthis]**, [size=smallcoordX], [size=smallcoordZ], [size=smallchunkprimer], [size=smallworld]); MinecraftForge.***[size=smallEVENT_BUS]***.post([size=smallevent]); **[size=smallif]** ([size=smallevent].getResult() == Result.***[size=smallDENY]***) **[size=smallreturn]**; **[size=smalldouble]** [size=smalld0] = 0.03125D; **[size=smallthis]**.[size=smallstoneNoise] = **[size=smallthis]**.[size=smallnoiseGen4].func_151599_a(**[size=smallthis]**.[size=smallstoneNoise], (**[size=smalldouble]**)([size=smallcoordX] * 16), (**[size=smalldouble]**)([size=smallcoordZ] * 16), 16, 16, [size=smalld0] * 2.0D, [size=smalld0] * 2.0D, 1.0D); **[size=smallfor]** (**[size=smallint]** [size=smallk] = 0; [size=smallk] < 16; ++[size=smallk]) { **[size=smallfor]** (**[size=smallint]** [size=smalll] = 0; [size=smalll] < 16; ++[size=smalll]) { BiomeGenPlains [size=small/*]**[size=smallTODO]**[size=small *ce* *biome* *est* a *remplacer* par *le* *votre**/] [size=smallbiomegenbase] = (BiomeGenPlains)[size=smallbiomeList][[size=smalll] + [size=smallk] * 16]; [size=smallbiomegenbase].genTerrainBlocks(**[size=smallthis]**.[size=smallworldObj], **[size=smallthis]**.[size=smallrand], [size=smallchunkprimer], [size=smallcoordX] * 16 + [size=smallk], [size=smallcoordZ] * 16 + [size=smalll], **[size=smallthis]**.[size=smallstoneNoise][[size=smalll] + [size=smallk] * 16]); } } }J’ai mis la plains pour être sûr que c’est bien le monde qui bug, et non le biome
Je ne sais pas si c’est ça qui bug, mais je ne pense pas. Dans le crash, ca réfère toujours cette ligne :**[size=smallint]**[] [size=smallaint] = **[size=smallthis]**.[size=smallBiomeIndexLayer].getInts([size=smallx], [size=smallz], [size=smallwidth], [size=smalllength]);Voilà, si vous savez comment faire, parce que moi je déséspère :-/</init>
-
si tu met BiomeGenPlains il faut le replacer partous ou tu as une référence à ton biome attention.
-
C’est déjà fait
-
tu peux renvoyer le code en entier ?
-
package This_is_Halloween.Frightful; import static net.minecraft.world.biome.BiomeGenBase.forest; import static net.minecraft.world.biome.BiomeGenBase.forestHills; import static net.minecraft.world.biome.BiomeGenBase.jungle; import static net.minecraft.world.biome.BiomeGenBase.jungleHills; import static net.minecraft.world.biome.BiomeGenBase.plains; import static net.minecraft.world.biome.BiomeGenBase.taiga; import static net.minecraft.world.biome.BiomeGenBase.taigaHills; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import com.google.common.collect.Lists; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.util.BlockPos; import net.minecraft.util.ReportedException; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.WorldTypeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class WorldChunkManagerFrightful extends WorldChunkManager { private BiomeGenBase biomegenbase; private GenLayer GenBiomes; private GenLayer BiomeIndexLayer; private BiomeCache BiomeCache; private List <biomegenbase>BiomesToSpawnIn; private List <biomegenbase>biomes; private static String field_180301_f; public WorldChunkManagerFrightful() { this.BiomeCache = new BiomeCache(this); this.BiomesToSpawnIn = new ArrayList<biomegenbase>(); this.BiomesToSpawnIn.add(BiomeGenBase.plains); } public WorldChunkManagerFrightful(long seed, WorldType worldtype, String string) { this(); GenLayer[] agenlayer = GenLayerFrightful.makeTheWorld(seed); this.GenBiomes = agenlayer[0]; this.BiomeIndexLayer = agenlayer[1]; } public WorldChunkManagerFrightful(World world) { this(world.getSeed(), world.getWorldInfo().getTerrainType(), field_180301_f); } public List <biomegenbase>getBiomesToSpawnIn() { return this.BiomesToSpawnIn; } public BiomeGenBase getBiomeGenAt(int x, int z) { BiomeGenBase biome = this.BiomeCache.func_180284_a(x, z, biomegenbase); if(biome == null) { return BiomeGenBase.plains; } return biome; } public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) { if(listToReuse == null || listToReuse.length < width * length) { listToReuse = new float[width * length]; } Arrays.fill(listToReuse, 0, width * length, 0.0F); return listToReuse; } @SideOnly(Side.CLIENT) public float getTemperatureAtHeight(float par1, int par2) { return par1; } public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } int[] aint = this.GenBiomes.getInts(par2, par3, par4, par5); for(int i = 0; i < par4 * par5; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = BiomeGenBase.plains; } } return par1ArrayOfBiomeGenBase; } public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) { return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true); } public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); if (listToReuse == null || listToReuse.length < width * length) { listToReuse = new BiomeGenBase[width * length]; } if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) { BiomeGenBase[] abiomegenbase1 = this.BiomeCache.getCachedBiomes(x, z); System.arraycopy(abiomegenbase1, 0, listToReuse, 0, width * length); return listToReuse; } else { int[] aint = this.BiomeIndexLayer.getInts(x, z, width, length); for(int i1 = 0; i1 < width * length; ++i1) { if(aint[i1] >= 0) { listToReuse[i1] = BiomeGenBase.getBiome(aint[i1]); } else { listToReuse[i1] = BiomeGenBase.plains; } } return listToReuse; } } public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); for(int j2 = 0; j2 < l1 * i2; ++j2) { BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]); if(!par4List.contains(biomegenbase)) { return false; } } return true; } public BlockPos findBiomePosition(int x, int z, int range, List list, Random random) { IntCache.resetIntCache(); int l = x - range >> 2; int i1 = z - range >> 2; int j1 = x + range >> 2; int k1 = z + range >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); BlockPos blockpos = null; int j2 = 0; for(int k2 = 0; k2 < l1 * i2; ++k2) { int l2 = l + k2 % l1 << 2; int i3 = i1 + k2 / l1 << 2; BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]); if(biomes.contains(biomegenbase) && (blockpos == null || random.nextInt(j2 + 1) == 0)) { blockpos = new BlockPos(l2, 0, i3); ++j2; } } return blockpos; } public void cleanupCache() { this.BiomeCache.cleanupCache(); } } ```</biomegenbase></biomegenbase></biomegenbase></biomegenbase> -
Je parler de toute les classes ^^ car tu as du en modifier
-
Désolé, j’ai pas compris que c’était toutes. Les voici :
BiomeGenEvilland (le biome, pas utilisé pour l’instant) :package This_is_Halloween.Frightful; import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; import This_is_Halloween.Entity.EntityEvilChicken; import This_is_Halloween.Entity.EntityEvilCow; import This_is_Halloween.Entity.EntityEvilPig; import This_is_Halloween.Entity.EntityEvilSheep; import This_is_Halloween.Entity.EntityGhost; import This_is_Halloween.Entity.EntityMummy; import This_is_Halloween.Entity.EntityVampire; public class BiomeGenEvilland extends BiomeGenBase{ public BiomeGenEvilland(int par1) { super(par1); this.spawnableCreatureList.clear(); this.spawnableCaveCreatureList.clear(); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilPig.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilSheep.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilChicken.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilCow.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityMummy.class, 50, 1, 4)); this.spawnableMonsterList.add(new SpawnListEntry(EntityVampire.class, 50, 1, 4)); this.spawnableMonsterList.add(new SpawnListEntry(EntityGhost.class, 50, 1, 4)); this.topBlock = Blocks.grass.getDefaultState(); this.fillerBlock = Blocks.dirt.getDefaultState(); this.theBiomeDecorator.treesPerChunk = 5; this.theBiomeDecorator.generateLakes = true; this.theBiomeDecorator.grassPerChunk = 5; this.theBiomeDecorator.flowersPerChunk = 4; this.theBiomeDecorator.mushroomsPerChunk = 2; this.theBiomeDecorator.reedsPerChunk = 2; } public WorldGenerator getRandomWorldGenForTrees(Random par1Random) { return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : new WorldGenTrees(false, 4, 0, 0, false)); } }BiomeGenLaayerFrightful :
package This_is_Halloween.Frightful; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; public class BiomeGenLayerFrightful extends GenLayer { protected BiomeGenBase[] baseBiomes = {BiomeGenBase.plains}; public BiomeGenLayerFrightful(long seed) { super(seed); } @Override public int[] getInts(int x, int z, int width, int depth) { int[] dest = IntCache.getIntCache(width * depth); for(int dz = 0; dz < depth; dz++) { for(int dx = 0; dx < width; dx++) { this.initChunkSeed(dx + x, dz + z); dest[(dx + dz * width)] = this.baseBiomes[nextInt(this.baseBiomes.length)].biomeID; } } return dest; } }BiomeList (me demande à quoi sert cette classe) :
package This_is_Halloween.Frightful; public class BiomeList { public static void BiomeList() { } }ChunkProviderFrightful :
package This_is_Halloween.Frightful; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA; import java.util.Iterator; import java.util.List; import java.util.Random; import com.google.common.collect.Lists; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; import net.minecraft.block.state.IBlockState; import net.minecraft.client.multiplayer.ChunkProviderClient; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenPlains; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderEnd; import net.minecraft.world.gen.ChunkProviderGenerate; import net.minecraft.world.gen.ChunkProviderSettings; import net.minecraft.world.gen.MapGenBase; import net.minecraft.world.gen.MapGenCaves; import net.minecraft.world.gen.MapGenRavine; import net.minecraft.world.gen.NoiseGenerator; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.NoiseGeneratorPerlin; import net.minecraft.world.gen.feature.WorldGenDungeons; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.structure.MapGenMineshaft; import net.minecraft.world.gen.structure.MapGenScatteredFeature; import net.minecraft.world.gen.structure.MapGenStronghold; import net.minecraft.world.gen.structure.MapGenStructure; import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraft.world.gen.structure.StructureOceanMonument; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate; import net.minecraftforge.event.terraingen.TerrainGen; import net.minecraftforge.fml.common.eventhandler.Event.Result; public class ChunkProviderFrightful implements IChunkProvider{ private Random rand; private NoiseGeneratorOctaves noiseGen1; private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorPerlin noiseGen4; public NoiseGeneratorOctaves noiseGen5; public NoiseGeneratorOctaves noiseGen6; public NoiseGeneratorOctaves mobSpawnerNoise; private World worldObj; private Block field_177476_s; private ChunkProviderSettings settings; private WorldType worldType; private final double[] noiseArray; private float[] parabolicField; private final double[] field_147434_q; private MapGenBase caveGenerator; private MapGenMineshaft mineshaftGenerator; private MapGenBase ravineGenerator; private boolean mapFeaturesEnabled; private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); private double[] stoneNoise = new double[256]; private BiomeGenBase[] biomesForGeneration; double[] noiseData1; double[] noiseData2; double[] noiseData3; double[] noiseData4; private final List structureGenerators = Lists.newArrayList(); private final IBlockState[] cachedBlockIDs = new IBlockState[256]; { caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); mineshaftGenerator = (MapGenMineshaft)TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); scatteredFeatureGenerator = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); } public ChunkProviderFrightful(World world, long seed, boolean features, String p_i45636_5_) { this.worldObj = world; this.mapFeaturesEnabled = features; this.worldType = world.getWorldInfo().getTerrainType(); 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, 8); this.noiseGen4 = new NoiseGeneratorPerlin(this.rand, 4); this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); this.noiseArray = new double[825]; this.parabolicField = new float[25]; for (int j = -2; j <= 2; ++j) { for (int k = -2; k <= 2; ++k) { float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F); this.parabolicField[j + 2 + (k + 2) * 5] = f; } } NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise}; noiseGens = TerrainGen.getModdedNoiseGenerators(world, this.rand, noiseGens); this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; this.noiseGen4 = (NoiseGeneratorPerlin)noiseGens[3]; this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; this.field_177476_s = Blocks.water; this.stoneNoise = new double[256]; this.caveGenerator = new MapGenCaves(); this.mineshaftGenerator = new MapGenMineshaft(); this.scatteredFeatureGenerator = new MapGenScatteredFeature(); this.ravineGenerator = new MapGenRavine(); { caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); mineshaftGenerator = (MapGenMineshaft)TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); scatteredFeatureGenerator = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); } this.worldObj = world; this.mapFeaturesEnabled = features; this.worldType = world.getWorldInfo().getTerrainType(); 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, 8); this.noiseGen4 = new NoiseGeneratorPerlin(this.rand, 4); this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); this.field_147434_q = new double[825]; this.parabolicField = new float[25]; for (int j = -2; j <= 2; ++j) { for (int k = -2; k <= 2; ++k) { float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F); this.parabolicField[j + 2 + (k + 2) * 5] = f; } } if (p_i45636_5_ != null) { this.settings = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b(); this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; } } public Chunk provideChunk(int x, int z) { this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); this.setBlocksInChunk(x, z, chunkprimer); this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); this.func_180517_a(x, z, chunkprimer, this.biomesForGeneration); Chunk chunk = new Chunk(this.worldObj, chunkprimer, 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; } public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) { this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_180518_1_ * 4 - 2, p_180518_2_ * 4 - 2, 10, 10); this.func_147423_a(p_180518_1_ * 4, 0, p_180518_2_ * 4); for (int k = 0; k < 4; ++k) { int l = k * 5; int i1 = (k + 1) * 5; for (int j1 = 0; j1 < 4; ++j1) { int k1 = (l + j1) * 33; int l1 = (l + j1 + 1) * 33; int i2 = (i1 + j1) * 33; int j2 = (i1 + j1 + 1) * 33; for (int k2 = 0; k2 < 32; ++k2) { double d0 = 0.125D; double d1 = this.noiseArray[k1 + k2]; double d2 = this.noiseArray[l1 + k2]; double d3 = this.noiseArray[i2 + k2]; double d4 = this.noiseArray[j2 + k2]; double d5 = (this.noiseArray[k1 + k2 + 1] - d1) * d0; double d6 = (this.noiseArray[l1 + k2 + 1] - d2) * d0; double d7 = (this.noiseArray[i2 + k2 + 1] - d3) * d0; double d8 = (this.noiseArray[j2 + k2 + 1] - d4) * d0; for (int l2 = 0; l2 < 8; ++l2) { double d9 = 0.25D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for (int i3 = 0; i3 < 4; ++i3) { double d14 = 0.25D; double d16 = (d11 - d10) * d14; double d15 = d10 - d16; for (int j3 = 0; j3 < 4; ++j3) { if ((d15 += d16) > 0.0D) { p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, Blocks.stone.getDefaultState()); } else if (k2 * 8 + l2 < 64) { p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, this.field_177476_s.getDefaultState()); } } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) { ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); MinecraftForge.EVENT_BUS.post(event); if (event.getResult() == Result.DENY) return; double d0 = 0.03125D; this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); for (int k = 0; k < 16; ++k) { for (int l = 0; l < 16; ++l) { BiomeGenBase biomegenbase = p_180517_4_[l + k * 16]; biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + k, p_180517_2_ * 16 + l, this.stoneNoise[l + k * 16]); } } } public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { return false; } private void func_147423_a(int x, int y, int z) { double d0 = 684.412D; double d1 = 684.412D; double d2 = 512.0D; double d3 = 512.0D; this.noiseData4 = this.noiseGen6.generateNoiseOctaves(this.noiseData4, x, z, 5, 5, 200.0D, 200.0D, 0.5D); this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, x, y, z, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D); this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, x, y, z, 5, 33, 5, 684.412D, 684.412D, 684.412D); this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, x, y, z, 5, 33, 5, 684.412D, 684.412D, 684.412D); boolean flag1 = false; boolean flag = false; int l = 0; int i1 = 0; double d4 = 8.5D; for (int j1 = 0; j1 < 5; ++j1) { for (int k1 = 0; k1 < 5; ++k1) { float f = 0.0F; float f1 = 0.0F; float f2 = 0.0F; byte b0 = 2; BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10]; for (int l1 = -b0; l1 <= b0; ++l1) { for (int i2 = -b0; i2 <= b0; ++i2) { BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10]; float f3 = biomegenbase1.minHeight; float f4 = biomegenbase1.maxHeight; float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F); if (biomegenbase1.minHeight > biomegenbase.minHeight) { f5 /= 2.0F; } f += f4 * f5; f1 += f3 * f5; f2 += f5; } } f /= f2; f1 /= f2; f = f * 0.9F + 0.1F; f1 = (f1 * 4.0F - 1.0F) / 8.0F; double d13 = this.noiseData4[i1] / 8000.0D; if (d13 < 0.0D) { d13 = -d13 * 0.3D; } d13 = d13 * 3.0D - 2.0D; if (d13 < 0.0D) { d13 /= 2.0D; if (d13 < -1.0D) { d13 = -1.0D; } d13 /= 1.4D; d13 /= 2.0D; } else { if (d13 > 1.0D) { d13 = 1.0D; } d13 /= 8.0D; } ++i1; double d12 = (double)f1; double d14 = (double)f; d12 += d13 * 0.2D; d12 = d12 * 8.5D / 8.0D; double d5 = 8.5D + d13 * 4.0D; for (int j2 = 0; j2 < 33; ++j2) { double d6 = ((double)j2 - d5) * 12.0D * 128.0D / 256.0D / d14; if (d6 < 0.0D) { d6 *= 4.0D; } double d7 = this.noiseData2[l] / 512.0D; double d8 = this.noiseData3[l] / 512.0D; double d9 = (this.noiseData1[l] / 10.0D + 1.0D) / 2.0D; double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6; if (j2 > 29) { double d11 = (double)((float)(j2 - 29) / 3.0F); d10 = d10 * (1.0D - d11) + -10.0D * d11; } this.noiseArray[l] = d10; ++l; } } } } public boolean chunkExists(int par1, int par2) { return true; } public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.fallInstantly = true; int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BlockPos blockpos = new BlockPos(k, 0, l); BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16)); this.rand.setSeed(this.worldObj.getSeed()); long i1 = this.rand.nextLong() / 2L * 2L + 1L; long j1 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed()); boolean flag = false; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); if (this.mapFeaturesEnabled) { this.scatteredFeatureGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); } int k1; int l1; int i2; boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON); for(k1 = 0; doGen && k1 < this.settings.dungeonChance; ++k1) { l1 = this.rand.nextInt(16) + 8; i2 = this.rand.nextInt(256); int j2 = this.rand.nextInt(16) + 8; (new WorldGenDungeons()).generate(this.worldObj, this.rand, blockpos.add(l1, i2, j2)); } biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(k, 0, l)); if(TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS)) { SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); } blockpos = blockpos.add(8, 0, 8); boolean doGen1 = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE); for(k1 = 0; doGen1 && k1 < 16; ++k1) { for(l1 = 0; l1 < 16; ++l1) { BlockPos blockpos1 = this.worldObj.getPrecipitationHeight(blockpos.add(k1, 0, l1)); BlockPos blockpos2 = blockpos1.down(); if(this.worldObj.func_175675_v(blockpos2)) { this.worldObj.setBlockState(blockpos2, Blocks.ice.getDefaultState(), 2); } if(this.worldObj.canSnowAt(blockpos1, true)) { this.worldObj.setBlockState(blockpos1, Blocks.snow_layer.getDefaultState(), 2); } } } MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); BlockFalling.fallInstantly = false; } public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { return true; } public void saveExtraData() {} public boolean unloadQueuedChunks() { return false; } public boolean canSave() { return true; } public String makeString() { return "FrightfulLevelSource"; } public List func_177458_a(EnumCreatureType p_177458_1_, BlockPos p_177458_2_) { BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(p_177458_2_); return biomegenbase.getSpawnableList(p_177458_1_); } public int getLoadedChunkCount() { return 0; } @Override public Chunk provideChunk(BlockPos blockPosIn) { return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); } @Override public BlockPos getStrongholdGen(World worldIn, String p_180513_2_, BlockPos p_180513_3_) { return null; } @Override public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) { Iterator iterator = this.structureGenerators.iterator(); while (iterator.hasNext()) { MapGenStructure mapgenstructure = (MapGenStructure)iterator.next(); mapgenstructure.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); } } public void replaceBlocksForBiome(int coordX, int coordZ, ChunkPrimer chunkprimer, byte[] arrayOfByte, BiomeGenBase[] biomeList) { World world = null; ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, coordX, coordZ, chunkprimer, world); MinecraftForge.EVENT_BUS.post(event); if (event.getResult() == Result.DENY) return; double d0 = 0.03125D; this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (double)(coordX * 16), (double)(coordZ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); for (int k = 0; k < 16; ++k) { for (int l = 0; l < 16; ++l) { BiomeGenPlains /*TODO ce biome est a remplacer par le votre*/ biomegenbase = (BiomeGenPlains)biomeList[l + k * 16]; biomegenbase.genTerrainBlocks(this.worldObj, this.rand, chunkprimer, coordX * 16 + k, coordZ * 16 + l, this.stoneNoise[l + k * 16]); } } } }GenLayerFrightful :
package This_is_Halloween.Frightful; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayerVoronoiZoom; import net.minecraft.world.gen.layer.GenLayerZoom; public abstract class GenLayerFrightful extends GenLayer{ public GenLayerFrightful(long seed) { super(seed); } public static GenLayer[] makeTheWorld(long seed) { GenLayer biomes = new BiomeGenLayerFrightful(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(seed); genlayervoronoizoom.initWorldGenSeed(seed); return new GenLayer[] {biomes, genlayervoronoizoom}; } }WorldChunkManagerFrightful :
package This_is_Halloween.Frightful; import static net.minecraft.world.biome.BiomeGenBase.forest; import static net.minecraft.world.biome.BiomeGenBase.forestHills; import static net.minecraft.world.biome.BiomeGenBase.jungle; import static net.minecraft.world.biome.BiomeGenBase.jungleHills; import static net.minecraft.world.biome.BiomeGenBase.plains; import static net.minecraft.world.biome.BiomeGenBase.taiga; import static net.minecraft.world.biome.BiomeGenBase.taigaHills; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import com.google.common.collect.Lists; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.util.BlockPos; import net.minecraft.util.ReportedException; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.WorldTypeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class WorldChunkManagerFrightful extends WorldChunkManager { private BiomeGenBase biomegenbase; private GenLayer GenBiomes; private GenLayer BiomeIndexLayer; private BiomeCache BiomeCache; private List <biomegenbase>BiomesToSpawnIn; private List <biomegenbase>biomes; private static String field_180301_f; public WorldChunkManagerFrightful() { this.BiomeCache = new BiomeCache(this); this.BiomesToSpawnIn = new ArrayList<biomegenbase>(); this.BiomesToSpawnIn.add(BiomeGenBase.plains); } public WorldChunkManagerFrightful(long seed, WorldType worldtype, String string) { this(); GenLayer[] agenlayer = GenLayerFrightful.makeTheWorld(seed); this.GenBiomes = agenlayer[0]; this.BiomeIndexLayer = agenlayer[1]; } public WorldChunkManagerFrightful(World world) { this(world.getSeed(), world.getWorldInfo().getTerrainType(), field_180301_f); } public List <biomegenbase>getBiomesToSpawnIn() { return this.BiomesToSpawnIn; } public BiomeGenBase getBiomeGenAt(int x, int z) { BiomeGenBase biome = this.BiomeCache.func_180284_a(x, z, biomegenbase); if(biome == null) { return BiomeGenBase.plains; } return biome; } public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) { if(listToReuse == null || listToReuse.length < width * length) { listToReuse = new float[width * length]; } Arrays.fill(listToReuse, 0, width * length, 0.0F); return listToReuse; } @SideOnly(Side.CLIENT) public float getTemperatureAtHeight(float par1, int par2) { return par1; } public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } int[] aint = this.GenBiomes.getInts(par2, par3, par4, par5); for(int i = 0; i < par4 * par5; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = BiomeGenBase.plains; } } return par1ArrayOfBiomeGenBase; } public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) { return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true); } public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); if (listToReuse == null || listToReuse.length < width * length) { listToReuse = new BiomeGenBase[width * length]; } if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) { BiomeGenBase[] abiomegenbase1 = this.BiomeCache.getCachedBiomes(x, z); System.arraycopy(abiomegenbase1, 0, listToReuse, 0, width * length); return listToReuse; } else { int[] aint = this.BiomeIndexLayer.getInts(x, z, width, length); for(int i1 = 0; i1 < width * length; ++i1) { if(aint[i1] >= 0) { listToReuse[i1] = BiomeGenBase.getBiome(aint[i1]); } else { listToReuse[i1] = BiomeGenBase.plains; } } return listToReuse; } } public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); for(int j2 = 0; j2 < l1 * i2; ++j2) { BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]); if(!par4List.contains(biomegenbase)) { return false; } } return true; } public BlockPos findBiomePosition(int x, int z, int range, List list, Random random) { IntCache.resetIntCache(); int l = x - range >> 2; int i1 = z - range >> 2; int j1 = x + range >> 2; int k1 = z + range >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); BlockPos blockpos = null; int j2 = 0; for(int k2 = 0; k2 < l1 * i2; ++k2) { int l2 = l + k2 % l1 << 2; int i3 = i1 + k2 / l1 << 2; BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]); if(biomes.contains(biomegenbase) && (blockpos == null || random.nextInt(j2 + 1) == 0)) { blockpos = new BlockPos(l2, 0, i3); ++j2; } } return blockpos; } public void cleanupCache() { this.BiomeCache.cleanupCache(); } }WorldProviderFrightful :
package This_is_Halloween.Frightful; import This_is_Halloween.This_is_Halloween; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderHell; import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.Side; public class WorldProviderFrightful extends WorldProvider{ private String generatorSettings; public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerFrightful(); this.hasNoSky = false; this.dimensionId = This_is_Halloween.dimensionID; } public IChunkProvider createChunkGenerator() { return new ChunkProviderFrightful(this.worldObj, this.worldObj.getSeed(), false, generatorSettings); } public String getDimensionName() { return This_is_Halloween.dimensionName; } public String getSaveFolder() { return this.getDimensionName(); } public boolean isSurfaceWorld() { return false; } public boolean canRespawnHere() { return false; } public boolean getWorldHasVoidParticles() { return true; } public int getHeight() { return 256; } protected void generateLightBrightnessTable() { float f = 0.2F; for(int i = 0; i <= 15; ++i) { float f1 = 1.0F - (float)i / 15.0F; this.lightBrightnessTable* = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f; } } // Moon's and Sun's Angle public float calculateCelestialAngle(long par1, float par2) { int j = (int)(par1 % 24000L); float f1 = ((float)j + par2) / 24000.0F - 0.25F; if(f1 < 0.0F) { ++f1; } if(f1 > 1.0F) { –f1; } float f2 = f1; f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) + 1.0D) / 2.0D); f1 = f2 + (f1 - f2) / 3.0F; return f1; } public int getMoonPhase(long par1) { return (int)(par1 / 24000L % 8L + 8L) % 8; } @SideOnly(Side.CLIENT) public boolean isSkyColored() { return false; } /**@Override public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { return Vec3.createVectorHelper(10, 0, 20); }**/ @Override public String getInternalNameSuffix() { return this.getSaveFolder(); } }EDIT : je viens de comprendre à quoi sert la classe BiomeList : je crois qu’elle sert à créer des nouveaux biomes, pour ne pas les mettre dans la classe principale. Est-ce bien ça ?</biomegenbase></biomegenbase></biomegenbase></biomegenbase>
-
pour répondre à ton edit, oui ^^
Ensuite, je suis pas content ! Je pense que tu te fou de ma gueule ! Je te fait des classes pas pour décorer ! je te les fait pour que tu les utilises. Ensuite CHANGE les références au variable des biomes par ton biome, dans ton chunkprovider change dans la fonction replaceBlocksForBiome BiomeGenBase par la classe de ton biome, et de même pour cette fonction func_177458_a. -
Désolé pour le temps de la réponse.
Je ne me fous pas de toi, j’ai mis ce que tu m’a donné, j’en suis sûr. Mais je n’ai pas copier, j’ai fait ligne par ligne (j’ai comparer avec ce que j’avais, j’ajoutais ce que j’avais pas et j’enlevais ce que j’avais). J’ai dû oublier des lignes. Là, j’ai remplacer mes classes par les tiennes (en corrigeant les erreurs et en faisant ce que tu m’a dis.
Même crash, référencés aux mêmes lignes, comme si j’ai rien changer -
Dans le code que je t’ai passer c’étais quoi comme érreur ?
-
Pour le ChunkProvider, je ne me souviens pas d’erreur
Pour le WorldChunkManager : dans cette fonction : ```java
public BiomeGenBase getBiomeGenAt(int x, int z)
{
BiomeGenBase biome = this.BiomeCache.func_180284_a(x, z, biomegenbase);if(biome == null)
{
return This_is_Halloween.This_is_Halloween.Evilland;
}
return biome;
}
, le biomegenbase n'était pas déclaré. Dans cette fonction :java
public WorldChunkManagerFrightful(World world)
{
this(world.getSeed(), world.getWorldInfo().getTerrainType());
}
, eclipse m'a proposer d'ajouter un String juste avant la dernière parenthèse, de supprimer pour laisser juste le this() ou de changer le constructeur. J'ai opter pour la 1ère option. Et dans cette fonction :java
public BlockPos findBiomePosition(int x, int z, int range, List list, Random random)
{
IntCache.resetIntCache();
int l = x - range >> 2;
int i1 = z - range >> 2;
int j1 = x + range >> 2;
int k1 = z + range >> 2;
int l1 = j1 - l + 1;
int i2 = k1 - i1 + 1;
int[] aint = this.GenBiomes.getInts(l, i1, l1, i2);
BlockPos blockpos = null;
int j2 = 0;for(int k2 = 0; k2 < l1 * i2; ++k2)
{
int l2 = l + k2 % l1 << 2;
int i3 = i1 + k2 / l1 << 2;
BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]);if(biomes.contains(biomegenbase) && (blockpos == null || random.nextInt(j2 + 1) == 0))
{
blockpos = new BlockPos(l2, 0, i3);
++j2;
}
}
return blockpos;
}J'ai ajouté : ```java private BiomeGenBase biomegenbase; private List <biomegenbase>biomes;Pour la 1ère et 3ème erreur, ce n’en est pas vraiment. En revanche, la 2ème, c’en était une et je ne sais pas si j’ai fait ce qu’il fallait.</biomegenbase>
-
dés que je rentre chez moi je vais chercher en profondeur.
-
Ok merci

-
Salut
J’ai plus ou moins régler le problème. Maintenant, la dimension marche avec mon biome.
Mais ce qui bug, c’est que presque à chaque fois, je spawn soit dans des blocks, soit dans l’eau, soit sur un arbre, mais presque jamais sur la terre ferme (ce qui, entre nous, est très embêtant, surtout quand t’es dans un block en survie).J’ai regardé dans la classe du biome, mais ça peut pas être dedans.
Voilà les classes que j’ai édité + le biome :ChunkProviderFrightful :
package This_is_Halloween.Frightful; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA; import java.util.Iterator; import java.util.List; import java.util.Random; import com.google.common.collect.Lists; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; import net.minecraft.block.state.IBlockState; import net.minecraft.client.multiplayer.ChunkProviderClient; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenPlains; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderEnd; import net.minecraft.world.gen.ChunkProviderGenerate; import net.minecraft.world.gen.ChunkProviderSettings; import net.minecraft.world.gen.MapGenBase; import net.minecraft.world.gen.MapGenCaves; import net.minecraft.world.gen.MapGenRavine; import net.minecraft.world.gen.NoiseGenerator; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.NoiseGeneratorPerlin; import net.minecraft.world.gen.feature.WorldGenDungeons; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.structure.MapGenMineshaft; import net.minecraft.world.gen.structure.MapGenScatteredFeature; import net.minecraft.world.gen.structure.MapGenStronghold; import net.minecraft.world.gen.structure.MapGenStructure; import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraft.world.gen.structure.StructureOceanMonument; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate; import net.minecraftforge.event.terraingen.TerrainGen; import net.minecraftforge.fml.common.eventhandler.Event.Result; public class ChunkProviderFrightful implements IChunkProvider { private Random rand; private NoiseGeneratorOctaves noiseGen1; private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorPerlin noiseGen4; public NoiseGeneratorOctaves noiseGen5; public NoiseGeneratorOctaves noiseGen6; public NoiseGeneratorOctaves mobSpawnerNoise; private World worldObj; private Block block; private ChunkProviderSettings settings; private WorldType worldType; private final double[] noiseArray; private float[] parabolicField; // private final double[] field_147434_q; private MapGenBase caveGenerator; private MapGenMineshaft mineshaftGenerator; private MapGenBase ravineGenerator; private boolean mapFeaturesEnabled; private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); private double[] stoneNoise = new double[256]; private BiomeGenBase[] biomesForGeneration; double[] noiseData1; double[] noiseData2; double[] noiseData3; double[] noiseData4; private final List structureGenerators = Lists.newArrayList(); private final IBlockState[] cachedBlockIDs = new IBlockState[256]; { caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); mineshaftGenerator = (MapGenMineshaft)TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); scatteredFeatureGenerator = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); } public ChunkProviderFrightful(World world, long seed, boolean features, String p_i45636_5_) { this.block = Blocks.water; this.worldObj = world; this.mapFeaturesEnabled = features; this.stoneNoise = new double[256]; this.worldType = world.getWorldInfo().getTerrainType(); 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, 8); this.noiseGen4 = new NoiseGeneratorPerlin(this.rand, 4); this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); this.noiseArray = new double[825]; this.parabolicField = new float[25]; this.caveGenerator = new MapGenCaves(); this.mineshaftGenerator = new MapGenMineshaft(); this.scatteredFeatureGenerator = new MapGenScatteredFeature(); this.ravineGenerator = new MapGenRavine(); for(int j = -2; j <= 2; ++j) { for(int k = -2; k <= 2; ++k) { float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F); this.parabolicField[j + 2 + (k + 2) * 5] = f; } } NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise}; noiseGens = TerrainGen.getModdedNoiseGenerators(world, this.rand, noiseGens); this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; this.noiseGen4 = (NoiseGeneratorPerlin)noiseGens[3]; this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; } public Chunk provideChunk(int x, int z) { this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); this.setBlocksInChunk(x, z, chunkprimer); this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); this.replaceBlockForBiome(x, z, chunkprimer, this.biomesForGeneration); this.caveGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer); this.ravineGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer); if(this.mapFeaturesEnabled) { this.scatteredFeatureGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer); } Chunk chunk = new Chunk(this.worldObj, chunkprimer, 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; } public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) { this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_180518_1_ * 4 - 2, p_180518_2_ * 4 - 2, 10, 10); this.func_147423_a(p_180518_1_ * 4, 0, p_180518_2_ * 4); for(int k = 0; k < 4; ++k) { int l = k * 5; int i1 = (k + 1) * 5; for(int j1 = 0; j1 < 4; ++j1) { int k1 = (l + j1) * 33; int l1 = (l + j1 + 1) * 33; int i2 = (i1 + j1) * 33; int j2 = (i1 + j1 + 1) * 33; for(int k2 = 0; k2 < 32; ++k2) { double d0 = 0.125D; double d1 = this.noiseArray[k1 + k2]; double d2 = this.noiseArray[l1 + k2]; double d3 = this.noiseArray[i2 + k2]; double d4 = this.noiseArray[j2 + k2]; double d5 = (this.noiseArray[k1 + k2 + 1] - d1) * d0; double d6 = (this.noiseArray[l1 + k2 + 1] - d2) * d0; double d7 = (this.noiseArray[i2 + k2 + 1] - d3) * d0; double d8 = (this.noiseArray[j2 + k2 + 1] - d4) * d0; for(int l2 = 0; l2 < 8; ++l2) { double d9 = 0.25D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for(int i3 = 0; i3 < 4; ++i3) { double d14 = 0.25D; double d16 = (d11 - d10) * d14; double d15 = d10 - d16; for(int j3 = 0; j3 < 4; ++j3) { if((d15 += d16) > 0.0D) { p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, Blocks.stone.getDefaultState()); } else if(k2 * 8 + l2 < 64) { p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, this.block.getDefaultState()); } } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { return false; } private void func_147423_a(int x, int y, int z) { double d0 = 684.412D; double d1 = 684.412D; double d2 = 512.0D; double d3 = 512.0D; this.noiseData4 = this.noiseGen6.generateNoiseOctaves(this.noiseData4, x, z, 5, 5, 200.0D, 200.0D, 0.5D); this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, x, y, z, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D); this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, x, y, z, 5, 33, 5, 684.412D, 684.412D, 684.412D); this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, x, y, z, 5, 33, 5, 684.412D, 684.412D, 684.412D); boolean flag1 = false; boolean flag = false; int l = 0; int i1 = 0; double d4 = 8.5D; for(int j1 = 0; j1 < 5; ++j1) { for(int k1 = 0; k1 < 5; ++k1) { float f = 0.0F; float f1 = 0.0F; float f2 = 0.0F; byte b0 = 2; BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10]; for(int l1 = -b0; l1 <= b0; ++l1) { for(int i2 = -b0; i2 <= b0; ++i2) { BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10]; float f3 = biomegenbase1.minHeight; float f4 = biomegenbase1.maxHeight; float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F); if(biomegenbase1.minHeight > biomegenbase.minHeight) { f5 /= 2.0F; } f += f4 * f5; f1 += f3 * f5; f2 += f5; } } f /= f2; f1 /= f2; f = f * 0.9F + 0.1F; f1 = (f1 * 4.0F - 1.0F) / 8.0F; double d13 = this.noiseData4[i1] / 8000.0D; if(d13 < 0.0D) { d13 = -d13 * 0.3D; } d13 = d13 * 3.0D - 2.0D; if(d13 < 0.0D) { d13 /= 2.0D; if(d13 < -1.0D) { d13 = -1.0D; } d13 /= 1.4D; d13 /= 2.0D; } else { if(d13 > 1.0D) { d13 = 1.0D; } d13 /= 8.0D; } ++i1; double d12 = (double)f1; double d14 = (double)f; d12 += d13 * 0.2D; d12 = d12 * 8.5D / 8.0D; double d5 = 8.5D + d13 * 4.0D; for(int j2 = 0; j2 < 33; ++j2) { double d6 = ((double)j2 - d5) * 12.0D * 128.0D / 256.0D / d14; if(d6 < 0.0D) { d6 *= 4.0D; } double d7 = this.noiseData2[l] / 512.0D; double d8 = this.noiseData3[l] / 512.0D; double d9 = (this.noiseData1[l] / 10.0D + 1.0D) / 2.0D; double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6; if(j2 > 29) { double d11 = (double)((float)(j2 - 29) / 3.0F); d10 = d10 * (1.0D - d11) + -10.0D * d11; } this.noiseArray[l] = d10; ++l; } } } } public boolean chunkExists(int par1, int par2) { return true; } public void populate(IChunkProvider chunk, int x, int z) { BlockFalling.fallInstantly = true; int k = x * 16; int l = z * 16; BlockPos blockpos = new BlockPos(k, 0, l); BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16)); this.rand.setSeed(this.worldObj.getSeed()); long i1 = this.rand.nextLong() / 2L * 2L + 1L; long j1 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed((long)x * i1 + (long)z * j1 ^ this.worldObj.getSeed()); boolean flag = false; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(chunk, worldObj, rand, x, z, flag)); if(this.mapFeaturesEnabled) { this.scatteredFeatureGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); } int k1; int l1; int i2; /* if(this.settings.useDungeons) { boolean doGen = TerrainGen.populate(chunk, worldObj, rand, x, z, flag, DUNGEON); for(k1 = 0; doGen && k1 < this.settings.dungeonChance; ++k1) { l1 = this.rand.nextInt(16) + 8; i2 = this.rand.nextInt(256); int j2 = this.rand.nextInt(16) + 8; (new WorldGenDungeons()).generate(this.worldObj, this.rand, blockpos.add(l1, i2, j2)); } }*/ biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(k, 0, l)); if(TerrainGen.populate(chunk, worldObj, rand, x, z, flag, ANIMALS)) { SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); } blockpos = blockpos.add(8, 0, 8); boolean doGen1 = TerrainGen.populate(chunk, worldObj, rand, x, z, flag, ICE); for(k1 = 0; doGen1 && k1 < 16; ++k1) { for(l1 = 0; l1 < 16; ++l1) { BlockPos blockpos1 = this.worldObj.getPrecipitationHeight(blockpos.add(k1, 0, l1)); BlockPos blockpos2 = blockpos1.down(); if(this.worldObj.func_175675_v(blockpos2)) { this.worldObj.setBlockState(blockpos2, Blocks.ice.getDefaultState(), 2); } if(this.worldObj.canSnowAt(blockpos1, true)) { this.worldObj.setBlockState(blockpos1, Blocks.snow_layer.getDefaultState(), 2); } } } MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(chunk, worldObj, rand, x, z, flag)); BlockFalling.fallInstantly = false; } public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { return true; } public void saveExtraData() { } public boolean unloadQueuedChunks() { return false; } public boolean canSave() { return true; } public String makeString() { return "RandomLevelSource"; } public List func_177458_a(EnumCreatureType p_177458_1_, BlockPos p_177458_2_) { BiomeGenEvilland biomegenevilland = (BiomeGenEvilland) this.worldObj.getBiomeGenForCoords(p_177458_2_); return biomegenevilland.getSpawnableList(p_177458_1_); } public int getLoadedChunkCount() { return 0; } @Override public Chunk provideChunk(BlockPos blockPosIn) { return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); } @Override public BlockPos getStrongholdGen(World worldIn, String p_180513_2_, BlockPos p_180513_3_) { return null; } @Override public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) { Iterator iterator = this.structureGenerators.iterator(); while(iterator.hasNext()) { MapGenStructure mapgenstructure = (MapGenStructure)iterator.next(); mapgenstructure.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); } } public void replaceBlockForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) { ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); MinecraftForge.EVENT_BUS.post(event); if(event.getResult() == Result.DENY) return; double d0 = 0.03125D; this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); for(int k = 0; k < 16; ++k) { for(int l = 0; l < 16; ++l) { BiomeGenEvilland biomegenevilland = (BiomeGenEvilland) p_180517_4_[l + k * 16]; biomegenevilland.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + k, p_180517_2_ * 16 + l, this.stoneNoise[l + k * 16]); } } } }WorldChunkManager
package This_is_Halloween.Frightful; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import com.google.common.collect.Lists; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.util.BlockPos; import net.minecraft.util.ReportedException; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.WorldTypeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class WorldChunkManagerFrightful extends WorldChunkManager { private GenLayer GenBiomes; private GenLayer BiomeIndexLayer; private BiomeCache BiomeCache; private List <biomegenbase>BiomesToSpawnIn; public WorldChunkManagerFrightful() { this.BiomeCache = new BiomeCache(this); this.BiomesToSpawnIn = new ArrayList<biomegenbase>(); this.BiomesToSpawnIn.add(This_is_Halloween.This_is_Halloween.Evilland); } public WorldChunkManagerFrightful(long seed, WorldType worldtype, long height) { this(); GenLayer[] agenlayer = GenLayerFrightful.makeTheWorld(seed); this.GenBiomes = agenlayer[0]; this.BiomeIndexLayer = agenlayer[1]; } public WorldChunkManagerFrightful(World world) { this(world.getSeed(), world.getWorldInfo().getTerrainType(), world.getActualHeight()); } public List <biomegenbase>getBiomesToSpawnIn() { return this.BiomesToSpawnIn; } public BiomeGenBase getBiomeGenAt(int x, int z, BiomeGenBase biome) { this.BiomeCache.func_180284_a(x, z, biome); if(biome == null) { return This_is_Halloween.This_is_Halloween.Evilland; } return biome; } public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) { if(listToReuse == null || listToReuse.length < width * length) { listToReuse = new float[width * length]; } Arrays.fill(listToReuse, 0, width * length, 0.0F); return listToReuse; } @SideOnly(Side.CLIENT) public float getTemperatureAtHeight(float par1, int par2) { return par1; } public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } int[] aint = this.GenBiomes.getInts(par2, par3, par4, par5); for(int i = 0; i < par4 * par5; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = This_is_Halloween.This_is_Halloween.Evilland; } } return par1ArrayOfBiomeGenBase; } public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) { return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true); } public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); if (listToReuse == null || listToReuse.length < width * length) { listToReuse = new BiomeGenBase[width * length]; } if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) { BiomeGenBase[] abiomegenbase1 = this.BiomeCache.getCachedBiomes(x, z); System.arraycopy(abiomegenbase1, 0, listToReuse, 0, width * length); return listToReuse; } else { int[] aint = this.BiomeIndexLayer.getInts(x, z, width, length); for(int i1 = 0; i1 < width * length; ++i1) { if(aint[i1] >= 0) { listToReuse[i1] = BiomeGenBase.getBiome(aint[i1]); } else { listToReuse[i1] = This_is_Halloween.This_is_Halloween.Evilland; } } return listToReuse; } } public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); for(int j2 = 0; j2 < l1 * i2; ++j2) { BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]); if(!par4List.contains(biomegenbase)) { return false; } } return true; } public BlockPos findBiomePosition(int x, int z, int range, List list, Random random) { IntCache.resetIntCache(); int l = x - range >> 2; int i1 = z - range >> 2; int j1 = x + range >> 2; int k1 = z + range >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.GenBiomes.getInts(l, i1, l1, i2); BlockPos blockpos = null; int j2 = 0; for(int k2 = 0; k2 < l1 * i2; ++k2) { int l2 = l + k2 % l1 << 2; int i3 = i1 + k2 / l1 << 2; BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]); if(((List<biomegenbase>)BiomeCache).contains(biomegenbase) && (blockpos == null || random.nextInt(j2 + 1) == 0)) { blockpos = new BlockPos(l2, 0, i3); ++j2; } } return blockpos; } public void cleanupCache() { this.BiomeCache.cleanupCache(); } }WorldProviderFrightful (d’ailleurs, avez-vous une méthode pour modifier la couleur du ciel, le code de la 1.7 ne marchant plus, ?):
package This_is_Halloween.Frightful; import This_is_Halloween.This_is_Halloween; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderHell; import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.Side; public class WorldProviderFrightful extends WorldProvider{ private WorldType terrainType; private String generatorSettings; public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerFrightful(worldObj.getSeed(), terrainType, dimensionId); this.hasNoSky = false; this.dimensionId = This_is_Halloween.dimensionID; this.isHellWorld = false; } public IChunkProvider createChunkGenerator() { return new ChunkProviderFrightful(this.worldObj, this.worldObj.getSeed(), false, generatorSettings); } public String getDimensionName() { return This_is_Halloween.dimensionName; } public String getSaveFolder() { return this.getDimensionName(); } public boolean isSurfaceWorld() { return false; } public boolean canRespawnHere() { return false; } public boolean getWorldHasVoidParticles() { return true; } public int getHeight() { return 256; } protected void generateLightBrightnessTable() { float f = 0.2F; for(int i = 0; i <= 15; ++i) { float f1 = 1.0F - (float)i / 15.0F; this.lightBrightnessTable* = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f; } } // Moon's and Sun's Angle public float calculateCelestialAngle(long par1, float par2) { int j = (int)(par1 % 24000L); float f1 = ((float)j + par2) / 24000.0F - 0.25F; if(f1 < 0.0F) { ++f1; } if(f1 > 1.0F) { –f1; } float f2 = f1; f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) + 1.0D) / 2.0D); f1 = f2 + (f1 - f2) / 3.0F; return f1; } public int getMoonPhase(long par1) { return (int)(par1 / 24000L % 8L + 8L) % 8; } @SideOnly(Side.CLIENT) public boolean isSkyColored() { return false; } /**@Override public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { return Vec3.createVectorHelper(10, 0, 20); }**/ @Override public String getInternalNameSuffix() { return this.getSaveFolder(); } public boolean canCoordinateBeSpawn(BlockPos pos) { int par1 = pos.getX(); int par2 = pos.getZ(); return this.worldObj.getTopSolidOrLiquidBlock(new BlockPos(par1, 0, par2)).equals(Blocks.grass); } }BiomeGenEvilland (le biome)
package This_is_Halloween.Frightful; import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; import This_is_Halloween.Entity.EntityEvilChicken; import This_is_Halloween.Entity.EntityEvilCow; import This_is_Halloween.Entity.EntityEvilPig; import This_is_Halloween.Entity.EntityEvilSheep; import This_is_Halloween.Entity.EntityGhost; import This_is_Halloween.Entity.EntityMummy; import This_is_Halloween.Entity.EntityVampire; public class BiomeGenEvilland extends BiomeGenBase{ public BiomeGenEvilland(int par1) { super(par1); this.spawnableCreatureList.clear(); this.spawnableCaveCreatureList.clear(); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilPig.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilSheep.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilChicken.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvilCow.class, 40, 8, 10)); this.spawnableMonsterList.add(new SpawnListEntry(EntityMummy.class, 50, 1, 4)); this.spawnableMonsterList.add(new SpawnListEntry(EntityVampire.class, 50, 1, 4)); this.spawnableMonsterList.add(new SpawnListEntry(EntityGhost.class, 50, 1, 4)); this.topBlock = Blocks.grass.getDefaultState(); this.fillerBlock = Blocks.dirt.getDefaultState(); this.theBiomeDecorator.treesPerChunk = 5; this.theBiomeDecorator.generateLakes = true; this.theBiomeDecorator.grassPerChunk = 5; this.theBiomeDecorator.flowersPerChunk = 4; this.theBiomeDecorator.mushroomsPerChunk = 2; this.theBiomeDecorator.reedsPerChunk = 2; } public WorldGenerator getRandomWorldGenForTrees(Random par1Random) { return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : new WorldGenTrees(false, 4, 0, 0, false)); } }Voilà
Merci d’avanceEDIT : je viens de trouver un autre problème, mais cette fois c’est avec le portal : si on reste dedans (ou qu’on en ressorte, c’est pareil), ça me reTP, et c’est comme ça en boucle. Même quand je met en pause, ca me remet en jeu pour TP. J’ai aussi un peut trouvé un bout de solution pour le 1er problème du portail : ça me TP dans Frightful à la couche du portail dans l’Overworld. C’est pas plus mal, ça peut corser un peu plus. Mais ça me met toujours dans des blocks,

Voilà donc ma classe du teleporter (à mon avis, c’est dedans) :
package This_is_Halloween.Frightful; import com.google.common.collect.Lists; import This_is_Halloween.CreateBlocks; import This_is_Halloween.Block.BlockPortalFrightful; import java.util.Iterator; import java.util.List; import java.util.Random; import net.minecraft.block.BlockPortal; import net.minecraft.block.BlockPumpkin; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; 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 TeleporterFrightful extends Teleporter { private final WorldServer worldServerInstance; /** A private Random() function in Teleporter */ private final Random random; /** Stores successful portal placement locations for rapid lookup. */ private final LongHashMap destinationCoordinateCache = new LongHashMap(); /** * A list of valid keys for the destinationCoordainteCache. These are based on the X & Z of the players initial * location. */ private final List destinationCoordinateKeys = Lists.newArrayList(); public TeleporterFrightful(WorldServer worldServer) { super(worldServer); this.worldServerInstance = worldServer; this.random = new Random(worldServer.getSeed()); } public void placeInPortal(Entity entityIn, float rotationYaw) { if (this.worldServerInstance.provider.getDimensionId() != 1) { if (!this.placeInExistingPortal(entityIn, rotationYaw)) { this.makePortal(entityIn); this.placeInExistingPortal(entityIn, rotationYaw); } } else { int i = MathHelper.floor_double(entityIn.posX); int j = MathHelper.floor_double(entityIn.posY) - 1; int k = MathHelper.floor_double(entityIn.posZ); 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; this.worldServerInstance.setBlockState(new BlockPos(k1, l1, i2), flag ? Blocks.pumpkin.getDefaultState() : Blocks.air.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.NORTH)); } } } entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F); entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D; } } public boolean placeInExistingPortal(Entity entityIn, float p_180620_2_) { boolean flag = true; double d0 = -1.0D; int i = MathHelper.floor_double(entityIn.posX); int j = MathHelper.floor_double(entityIn.posZ); boolean flag1 = true; Object object = BlockPos.ORIGIN; long k = ChunkCoordIntPair.chunkXZ2Int(i, j); if (this.destinationCoordinateCache.containsItem(k)) { TeleporterFrightful.PortalPosition portalposition = (TeleporterFrightful.PortalPosition)this.destinationCoordinateCache.getValueByKey(k); d0 = 0.0D; object = portalposition; portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); flag1 = false; } else { BlockPos blockpos4 = new BlockPos(entityIn); for (int l = -128; l <= 128; ++l) { BlockPos blockpos1; for (int i1 = -128; i1 <= 128; ++i1) { for (BlockPos blockpos = blockpos4.add(l, this.worldServerInstance.getActualHeight() - 1 - blockpos4.getY(), i1); blockpos.getY() >= 0; blockpos = blockpos1) { blockpos1 = blockpos.down(); if (this.worldServerInstance.getBlockState(blockpos).getBlock() == CreateBlocks.PortalFrightful) { while (this.worldServerInstance.getBlockState(blockpos1 = blockpos.down()).getBlock() == CreateBlocks.PortalFrightful) { blockpos = blockpos1; } double d1 = blockpos.distanceSq(blockpos4); if (d0 < 0.0D || d1 < d0) { d0 = d1; object = blockpos; } } } } } } if (d0 >= 0.0D) { if (flag1) { this.destinationCoordinateCache.add(k, new TeleporterFrightful.PortalPosition((BlockPos)object, this.worldServerInstance.getTotalWorldTime())); this.destinationCoordinateKeys.add(Long.valueOf(k)); } double d4 = (double)((BlockPos)object).getX() + 0.5D; double d5 = (double)((BlockPos)object).getY() + 0.5D; double d6 = (double)((BlockPos)object).getZ() + 0.5D; EnumFacing enumfacing = null; if (this.worldServerInstance.getBlockState(((BlockPos)object).west()).getBlock() == CreateBlocks.PortalFrightful) { enumfacing = EnumFacing.NORTH; } if (this.worldServerInstance.getBlockState(((BlockPos)object).east()).getBlock() == CreateBlocks.PortalFrightful) { enumfacing = EnumFacing.SOUTH; } if (this.worldServerInstance.getBlockState(((BlockPos)object).north()).getBlock() == CreateBlocks.PortalFrightful) { enumfacing = EnumFacing.EAST; } if (this.worldServerInstance.getBlockState(((BlockPos)object).south()).getBlock() == CreateBlocks.PortalFrightful) { enumfacing = EnumFacing.WEST; } EnumFacing enumfacing1 = EnumFacing.getHorizontal(entityIn.getTeleportDirection()); if (enumfacing != null) { EnumFacing enumfacing2 = enumfacing.rotateYCCW(); BlockPos blockpos2 = ((BlockPos)object).offset(enumfacing); boolean flag2 = this.func_180265_a(blockpos2); boolean flag3 = this.func_180265_a(blockpos2.offset(enumfacing2)); if (flag3 && flag2) { object = ((BlockPos)object).offset(enumfacing2); enumfacing = enumfacing.getOpposite(); enumfacing2 = enumfacing2.getOpposite(); BlockPos blockpos3 = ((BlockPos)object).offset(enumfacing); flag2 = this.func_180265_a(blockpos3); flag3 = this.func_180265_a(blockpos3.offset(enumfacing2)); } float f6 = 0.5F; float f1 = 0.5F; if (!flag3 && flag2) { f6 = 1.0F; } else if (flag3 && !flag2) { f6 = 0.0F; } else if (flag3) { f1 = 0.0F; } d4 = (double)((BlockPos)object).getX() + 0.5D; d5 = (double)((BlockPos)object).getY() + 0.5D; d6 = (double)((BlockPos)object).getZ() + 0.5D; d4 += (double)((float)enumfacing2.getFrontOffsetX() * f6 + (float)enumfacing.getFrontOffsetX() * f1); d6 += (double)((float)enumfacing2.getFrontOffsetZ() * f6 + (float)enumfacing.getFrontOffsetZ() * f1); float f2 = 0.0F; float f3 = 0.0F; float f4 = 0.0F; float f5 = 0.0F; if (enumfacing == enumfacing1) { f2 = 1.0F; f3 = 1.0F; } else if (enumfacing == enumfacing1.getOpposite()) { f2 = -1.0F; f3 = -1.0F; } else if (enumfacing == enumfacing1.rotateY()) { f4 = 1.0F; f5 = -1.0F; } else { f4 = -1.0F; f5 = 1.0F; } double d2 = entityIn.motionX; double d3 = entityIn.motionZ; entityIn.motionX = d2 * (double)f2 + d3 * (double)f5; entityIn.motionZ = d2 * (double)f4 + d3 * (double)f3; entityIn.rotationYaw = p_180620_2_ - (float)(enumfacing1.getHorizontalIndex() * 90) + (float)(enumfacing.getHorizontalIndex() * 90); } else { entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D; } entityIn.setLocationAndAngles(d4, d5, d6, entityIn.rotationYaw, entityIn.rotationPitch); return true; } else { return false; } } private boolean func_180265_a(BlockPos p_180265_1_) { return !this.worldServerInstance.isAirBlock(p_180265_1_) || !this.worldServerInstance.isAirBlock(p_180265_1_.up()); } public boolean makePortal(Entity p_85188_1_) { byte b0 = 16; double d0 = -1.0D; int i = MathHelper.floor_double(p_85188_1_.posX); int j = MathHelper.floor_double(p_85188_1_.posY); int k = MathHelper.floor_double(p_85188_1_.posZ); int l = i; int i1 = j; int j1 = k; 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 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - p_85188_1_.posX; for (k2 = k - b0; k2 <= k + b0; ++k2) { d2 = (double)k2 + 0.5D - p_85188_1_.posZ; label271: for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2))) { while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(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; if (k4 < 0 && !this.worldServerInstance.getBlockState(new BlockPos(l4, i5, j5)).getBlock().getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(new BlockPos(l4, i5, j5))) { continue label271; } } } } d3 = (double)i3 + 0.5D - p_85188_1_.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 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - p_85188_1_.posX; for (k2 = k - b0; k2 <= k + b0; ++k2) { d2 = (double)k2 + 0.5D - p_85188_1_.posZ; label219: for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2))) { while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(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; if (j4 < 0 && !this.worldServerInstance.getBlockState(new BlockPos(k4, l4, i5)).getBlock().getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(new BlockPos(k4, l4, i5))) { continue label219; } } } d3 = (double)i3 + 0.5D - p_85188_1_.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; } if (d0 < 0.0D) { i1 = MathHelper.clamp_int(i1, 70, 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; boolean flag = k3 < 0; this.worldServerInstance.setBlockState(new BlockPos(l3, i4, j4), flag ? Blocks.pumpkin.getDefaultState() : Blocks.air.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.NORTH)); } } } } IBlockState iblockstate = CreateBlocks.PortalFrightful.getDefaultState().withProperty(BlockPortalFrightful.AXIS, l5 != 0 ? EnumFacing.Axis.X : EnumFacing.Axis.Z); for (j3 = 0; j3 < 4; ++j3) { for (k3 = 0; k3 < 4; ++k3) { for (l3 = -1; l3 < 4; ++l3) { i4 = k5 + (k3 - 1) * l5; j4 = j2 + l3; k4 = k2 + (k3 - 1) * l2; boolean flag1 = k3 == 0 || k3 == 3 || l3 == -1 || l3 == 3; this.worldServerInstance.setBlockState(new BlockPos(i4, j4, k4), flag1 ? Blocks.pumpkin.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.NORTH) : iblockstate, 2); } } for (k3 = 0; k3 < 4; ++k3) { for (l3 = -1; l3 < 4; ++l3) { i4 = k5 + (k3 - 1) * l5; j4 = j2 + l3; k4 = k2 + (k3 - 1) * l2; this.worldServerInstance.notifyNeighborsOfStateChange(new BlockPos(i4, j4, k4), this.worldServerInstance.getBlockState(new BlockPos(i4, j4, k4)).getBlock()); } } } return true; } /** * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a * WorldServer.getTotalWorldTime() value. */ public void removeStalePortalLocations(long p_85189_1_) { if (p_85189_1_ % 100L == 0L) { Iterator iterator = this.destinationCoordinateKeys.iterator(); long j = p_85189_1_ - 600L; while (iterator.hasNext()) { Long olong = (Long)iterator.next(); TeleporterFrightful.PortalPosition portalposition = (TeleporterFrightful.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue()); if (portalposition == null || portalposition.lastUpdateTime < j) { iterator.remove(); this.destinationCoordinateCache.remove(olong.longValue()); } } } } public class PortalPosition extends BlockPos { /** The worldtime at which this PortalPosition was last verified */ public long lastUpdateTime; public PortalPosition(BlockPos pos, long p_i45747_3_) { super(pos.getX(), pos.getY(), pos.getZ()); this.lastUpdateTime = p_i45747_3_; } } } ```</biomegenbase></biomegenbase></biomegenbase></biomegenbase> -
Salut
J’ai regardé précisément dans toutes les classes qui concerne plus ou moins loin le monde (à part le biome, qui n’à absolument rien à voir avec mes problèmes), mais je n’ai rien trouvé. J’ai re-regardé mes classes en comparant avec ceux vanilla pour voir si il manquait du code, mais non.En espérant que quelqu’un puisse m’aider…
PS : je continue tout de même à chercher
-
Change
java TeleporterFrightfulpar ```java
Teleporter -
Ca me fais toujours les mêmes bugs. Mais je n’ai pas compris pourquoi changer de nom la classe. Pourrais-tu m’expliquer stp ?
-
Non pas changer le nom de classe mais par exemple ceci ```java
TeleporterFrightful.PortalPosition portalposition = (TeleporterFrightful.PortalPosition)this.destinationCoordinateCache.getValueByKey(k);en ```java Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition)this.destinationCoordinateCache.getValueByKey(k);Désolé j’ai pas préciser ^^
