-
Limited World Generation Mod
So here's the code to cut off world generation after a certain number of chunks past spawn. Just as a reminder, this is under the net.minecraft.chunk package under the Chunk class. This is a rewrite of the populateChunk method: public void populateChunk(IChunkProvider interface1, IChunkProvider interface2, int posX, int posY) { //Get the spawn coordinate ChunkCoordinates spawn = worldObj.getSpawnPoint(); //These are the number of chunks to generate on each side of spawn chunk (if each is set to 0 you will get a world consisting of just the spawn chunk) //Each world will have an odd number of chunks because it consists of the spawn chunk plus 2*worldChunksVariable int worldXChunks = 1; //(*2+1) int worldZChunks = 1; //(*2+1) //this if statement says if the coordinate of the x chunk its checking is within the bounds of the spawn chunk +/- worldXChunks //and if the z chunk is also within its bounds, continue with world generation if(posX <= (spawn.posX/16)+worldXChunks && posX >= (spawn.posX/16)-worldXChunks && posY <= (spawn.posZ/16)+worldZChunks && posY >= (spawn.posZ/16)-worldZChunks) { //Normal chunk generation if (!this.isTerrainPopulated && interface1.chunkExists(posX + 1, posY + 1) && interface1.chunkExists(posX, posY + 1) && interface1.chunkExists(posX + 1, posY)) { interface1.populate(interface2, posX, posY); } if (interface1.chunkExists(posX - 1, posY) && !interface1.provideChunk(posX - 1, posY).isTerrainPopulated && interface1.chunkExists(posX - 1, posY + 1) && interface1.chunkExists(posX, posY + 1) && interface1.chunkExists(posX - 1, posY + 1)) { interface1.populate(interface2, posX - 1, posY); } if (interface1.chunkExists(posX, posY - 1) && !interface1.provideChunk(posX, posY - 1).isTerrainPopulated && interface1.chunkExists(posX + 1, posY - 1) && interface1.chunkExists(posX + 1, posY - 1) && interface1.chunkExists(posX + 1, posY)) { interface1.populate(interface2, posX, posY - 1); } if (interface1.chunkExists(posX - 1, posY - 1) && !interface1.provideChunk(posX - 1, posY - 1).isTerrainPopulated && interface1.chunkExists(posX, posY - 1) && interface1.chunkExists(posX - 1, posY)) { interface1.populate(interface2, posX - 1, posY - 1); } } } Now this code is not perfect. It seems as though somewhere else in the code the world wants to keep attempting to generate chunks past the limit and as such causes the player to glitch out when in the area where a chunk would be. If I have time between work and school this week I'll work on sorting that out so that the area around the chunk limit isn't glitchy and the player can just jump off the world and fall into the void.
-
Limited World Generation Mod
Now would be a good time to mention that I switched over to MCP for now because Minecrat Forge makes it annoyingly hard to edit base classes and I'm not too concerned about compatibility with other mods anyway. I've been looking into the net.minecraft.world.chunk package more and under the Chunk class there's a method called populate chunk that populates a chunk if the chunk it checks is empty. If I constrain the values it checks, it may prevent chunk population beyond those values. I'll report back once I figure it out.
-
Limited World Generation Mod
Yea there are a number of mods that keep the player within a boundary with "invisible walls" such as worldborder, but I do want to do as you stated and have a world where players could fall off the edge and possible even build out up to 100 blocks away from the edge. I would also want a 1 block thick stone barrier around the entire thing so players can't easily gather ores, but I may just end up doing that in world edit. I haven't looked into populator events but I'll probably research it a bit. I've also started exploring the net.minecraft.world.chunk package and in the IChunkProvider interface there are calls to provide a chunk at a given value and load a chunk at a given value. If I can constrain the values going into those calls with an if statement, I may be able to stop generation outside those constrained values.
-
Limited World Generation Mod
Hello all. I want to create a mod that stops the world from generating chunks after a certain number of chunks from spawn have been generated. In other words, I want to be able to create a map that is around 1000 by 1000 blocks in x and z coordinates. Since the world is generated in chunks, this will be approximately 60x60 chunks. I am using Forge 1.7.10 and have everything loaded into an Eclipse project. What I want to know is: in what class should I look to limit world generation. In what class does it specify that when the player is x blocks from the edge of the world, generate new chunks. Thanks.
IPS spam blocked by CleanTalk.