Posted February 20, 201411 yr Hi, I am trying to add a water dimension to my mod. I would like to make the ambient block a custom fluid instead of air. Is there a way to do this? Thanks Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
February 20, 201411 yr I know very little about adding new dimensions, but I guess your dimension uses some kind of ChunkProvider derivative, right? It's only a matter of tuning that class to your needs. Find the part where it's placing air, and replace it with your fluid. http://i.imgur.com/YOLa0KX.png[/img]
February 20, 201411 yr Or you can make an ugly code, and use events. Create Tick Event >> Check if in Dimension >> Check all Blocks [air:0] >> Replace all Blocks [air:0] -- [water:8/9] 8 for Flowing Water 9 for Still Water If you need further help, you may ask
February 21, 201411 yr Author Thanks! It seems that the air generation code is not in the ChunkProvider. What exactly are the names of the events and how would I use them? Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
February 21, 201411 yr There is no code that explicitly generates air. In fact air is not an actual block at all, but just an id (0) which is conveniently the default value that the byte array used in terrain generation. So essentially, any block that is not set to something else is, by default, air. That being said, a short explanation of the terrain generation process. The generation of the basic terrain is entirely contained in the ChunkProvider class. First the generateTerrain method creates the basic shape of the chunk by placing stone. First it randomly calculates the height of each of the 256 columns (16 x 16) in the chunk, and then sets the id of each block in at or below that height to stone. Then the replaceBlocksForBiome method replaces some of these stone blocks with the biome's (for that column -- each column in a chunk can have a different biome) top and filler blocks. By default this is dirt and grass, and this method is how the chunks get covered in dirt and grass (or sand in a desert biome). Incidentally, (and this is probably the part you will be most interested in) any air blocks below a certain level are already being replaced by water in the vanilla chunk generator. You could create a custom ChunkProvider class with a modified value for this variable (such as 256?) and a modified replaceBlocksForBiome method that places your custom fluid instead of water. In 1.6.4, this is done in the replaceBlocksForBiome method, but in 1.7.2 (at least the version I downloaded), this appears to be done in the generateTerrain method. Look for a variable that is set to 63 in the vanilla code. In 1.6.4, it is a class field, but in 1.7.2 it seems to be local to generateTerrain. One thing that must be said here is that in 1.6.4 any block which you want to be placed by the ChunkProvider class must have an id below 256 since generateTerrain and replaceBlocksForBiome use an array of bytes to hold the block Ids for the chunk (256 is the highest value that can be held by a byte variable). In 1.7.2 these functions use an array of Block objects to hold this data, so block ID is not an issue. (Before anyone tells me that there aren't block Ids in 1.7.2, there are. It's just that modder's don't have to worry about them anymore -- FML handles all that now). So bottom line, look into ChunkProviderGenerate (if you want more than one biome -- ChunkProviderHell otherwise) and create a custom ChunkProvider that sets the sea level (what I've taken to calling that variable) higher and possibly places your custom fluid block. The best protection for all you meat-related data.
February 21, 201411 yr Author Thanks! It worked. Also, does anyone know of an event to replace blocks with a fluid when broken? Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
February 21, 201411 yr There probably is a block break event that I don't know about somewhere. I assume you are trying to fill in any broken blocks with your custom fluid. Alternatively, you could give your fluid a flowing mechanic so that it fills in any holes. http://i.imgur.com/YOLa0KX.png[/img]
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.