Posted October 27, 201510 yr Hey there, I'm working on a custom dimension but for my dimension i need a chunk provider that makes it so it only generates a custom block 1 layer above the void. Although I've tried reading into guides/tutrials about world generation i could not put my head around it. Would someone be able to help me out as I find the world generating code quite confusing?
October 27, 201510 yr In your dimension's IChunkProvider in provideChunk method, create new Chunk with Block[] in arguments. Pas it as Block[] blocks where Block[] blocks = new Block[655536] . Before creating new Chunk , fill blocks with blocks you need, where you need, using this to set block: blocks[blockXPos <<11 | blockZPos << 7 | blockYPos] = blockYouWantThere . Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
October 27, 201510 yr Author I assume you meant something like this? public Chunk provideChunk(int par1, int par2) { Block[] blocks = new Block[655536]; Chunk chunk = new Chunk(world, blocks, par2, par2); for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { blocks[0] = BlockHandler.MossDirt; } } return chunk; }
October 27, 201510 yr I assume you meant something like this? public Chunk provideChunk(int par1, int par2) { Block[] blocks = new Block[655536]; Chunk chunk = new Chunk(world, blocks, par2, par2); for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { blocks[0] = BlockHandler.MossDirt; } } return chunk; } Nearly. Apply changes to blocks before Chunk chunk = new Chunk . Also, below i told you how to convert x, y and inside chunk to position in blocks ( x<<11 | z<< 7 | y ). Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
October 27, 201510 yr Author I honestly don't get it. the "below i told you how to convert x, y and inside chunk to position in blocks (x<<11 | z<< 7 | y)" confuses me of what to do. could you perhaps give me some pseudo-code example?
October 27, 201510 yr I honestly don't get it. the "below i told you how to convert x, y and inside chunk to position in blocks (x<<11 | z<< 7 | y)" confuses me of what to do. could you perhaps give me some pseudo-code example? Ok, let's say that i want to set some blocks blocks at (x, y, z) to diamond blocks. In here, i'm putting diamond blocks at (0, 0, 0), (12, 128, 16) and (7, 245, 11): blocks[0<<11 | 0<< 7 | 0] = Blocks.diamondBlock; blocks[12<<11 | 16<< 7 | 128] = Blocks.diamondBlock; blocks[7<<11 | 11<< 7 | 245] = Blocks.diamondBlock; Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
October 27, 201510 yr You don't want 655536, but 16*16*128=65536, see the extra 5? Also, he told you to populate the blocks array before making a new chunk, else you would create an empty Chunk and than populate an array which will never be used again in that method. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
October 27, 201510 yr Author right got that, while i was at it i tried testing out to see if i was able to enter the dimension. Although the teleporter tp'd me back onto the exact same spot i already was in the overworld... if(!world.isRemote) { FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension( (EntityPlayerMP) player, 0, new TeleportTo(MinecraftServer.getServer().worldServerForDimension(ARMain.dimensionId))); } was used to tp to my dimension. its called upon activating a block.
October 27, 201510 yr You don't want 655536, but 16*16*128=65536, see the extra 5? Yes, not 655536... But neither 16*16*128 (=32768) ... You want 16*16*256=65536... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
October 27, 201510 yr Author You don't want 655536, but 16*16*128=65536, see the extra 5? Yes, not 655536... But neither 16*16*128 (=32768) ... You want 16*16*256=65536... I figured ah well thanks anyways for the help, i just assume that I switch out the coords with the ints of my for loops so it runs through the entire chunk.
October 27, 201510 yr You don't want 655536, but 16*16*128=65536, see the extra 5? Yes, not 655536... But neither 16*16*128 (=32768) ... You want 16*16*256=65536... I figured ah well thanks anyways for the help, i just assume that I switch out the coords with the ints of my for loops so it runs through the entire chunk. Yup. But do you need to run through entire chunk? Or just through y=1? Don't do unnecessary operations. Null blocks in [] will be automatically read as air. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
October 27, 201510 yr Author You don't want 655536, but 16*16*128=65536, see the extra 5? Yes, not 655536... But neither 16*16*128 (=32768) ... You want 16*16*256=65536... I figured ah well thanks anyways for the help, i just assume that I switch out the coords with the ints of my for loops so it runs through the entire chunk. Yup. But do you need to run through entire chunk? Or just through y=1? Don't do unnecessary operations. Null blocks in [] will be automatically read as air. Oh no, not at all. I'm just running through the x and z's of the chunk because the y is always constant. also while i was at it i tried testing out to see if i was able to enter the dimension. Although the teleporter tp'd me back onto the exact same spot i already was in the overworld... if(!world.isRemote) { FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension( (EntityPlayerMP) player, 0, new TeleportTo(MinecraftServer.getServer().worldServerForDimension(ARMain.dimensionId))); } was used to tp to my dimension. its called upon activating a block.
October 27, 201510 yr Author Never mind, i fixed the teleport problem with some help of an old forum thread.
October 28, 201510 yr Author I seem to have a new problem now where it only places 1 block per chunk instead of running through my for loops for the entire x and z square coords. public Chunk provideChunk(int par1, int par2) { Block[] blocks = new Block[65536]; blocks[0] = BlockHandler.MossDirt; Chunk chunk = new Chunk(world, blocks, par1, par2); for(int x = 0; x < 15; x++) { for(int z = 0; z < 15; z++) { blocks[x<<11 | z<< 7 | 0] = BlockHandler.MossDirt; } } chunk.generateSkylightMap(); return chunk; }
October 28, 201510 yr I seem to have a new problem now where it only places 1 block per chunk instead of running through my for loops for the entire x and z square coords. public Chunk provideChunk(int par1, int par2) { Block[] blocks = new Block[65536]; blocks[0] = BlockHandler.MossDirt; Chunk chunk = new Chunk(world, blocks, par1, par2); for(int x = 0; x < 15; x++) { for(int z = 0; z < 15; z++) { blocks[x<<11 | z<< 7 | 0] = BlockHandler.MossDirt; } } chunk.generateSkylightMap(); return chunk; } Didn't i say that you run your loops before Chunk chunk = new Chunk ? Or was it on another thread about dimensions? Anyway, you must run your loops before creating new chunk. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
October 28, 201510 yr Author Thank you, that fixed it ^_^also, nah you only told me to do the blocks array before the actual chunk creation. but thanks a lot!
October 28, 201510 yr Thank you, that fixed it ^_^also, nah you only told me to do the blocks array before the actual chunk creation. but thanks a lot! Ok. If it is fixed, add [sOLVED] to the title after mc version. Like that, everybody knows that this problem is solved . Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
October 28, 201510 yr Author Thank you, that fixed it ^_^also, nah you only told me to do the blocks array before the actual chunk creation. but thanks a lot! Ok. If it is fixed, add [sOLVED] to the title after mc version. Like that, everybody knows that this problem is solved . Done and done
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.