I was playing around with MCP and I decided to try to find out how to increase the average height of terrain; that is, near sea level, without changing the terrain otherwise, sort of like Amplified but raising the entire world up. I had previously attempted to do this before but with horrible glitches (among others) This time though, I found a mod that did something similar, the Wedge mod, and I decompiled it (luckily the code was still available) to see what was changed.
This was the result when I applied the changes from the Wedge mod (just those that enabled terrain to go to the world height limit), after some trial and error; what I did here was add 64 to the terrain data and fill in the lower 64 layers with stone and a layer of bedrock at y = 0 (removing the original bedrock, which would otherwise block the lower 64 layers):
Here is a screenshot from the top of a mountain showing a y-coordinate of 181:
For comparison, here is the same world generated with normal terrain (it looks a lot darker because the mapping program makes higher elevations lighter):
I also had to fix up some other things, like change the range of generation in BiomeDecorator and WorldGenSwamp, although there are still some bugs present (e.g. no squid spawn in water since they only spawn below y = 63; a swamp hut generated mostly underwater without stilts).
Of course, I also modified the generation of ores to account for this (doubling the range and the number generated will keep the density the same):
You can see I did something different with the rarer/lower ores, which I had already modified, before doubling the terrain height; the lava level here is 3 (instead of 10 or doubled to 20). Note also that in the genOres methods I added a check for negative y-values, not testing to see if it would crash without it (done because you can't generate fractional veins).
As for why I wanted to do this, check out the height of the caves; I only had to double the y-range in the cave generator to get them to generate to the surface, doubling the number of caves per system in the process to maintain the same density (I also split the height algorithm in two so 50% of caves in a system generate like normal, with more caves lower down, and the other 50% generate uniformly spread out along the y-axis, with a vertical cave running up through the center to the surface); I also did the same with ravines (imagine a 100+ block drop down 2-3 stacked ravines...):
I had actually already done something similar when I modified cave generation in order to get the most of the the available terrain; I reduced bedrock to just one layer and lowered the level of lava in caves from 10 to 3 and lowered the min/max of rarer ores by 7 (so there is the same amount of diamond, etc, above the lava level but less overall, although if you branch mined you'd find the same amount at the corresponding lower layer).
Oh yeah, by changing a single variable I can easily adjust the height of terrain all the way up to the world height limit; for example, add 128 (the max) instead of 64:
(I didn't bother making a larger map here or correcting caves, etc, but it would be easy to pass in a variable to each of the classes that needs to be modified)
I haven't actually tried playing on this kind of world yet, outside of just exploring it in Creative while testing in MCP, but it would be interesting if this could be added as a vanilla world generation option; I call this "Double Height Terrain" (the above would be triple height).
Note also that while the screenshot shows I am using Forge it is only because I use Forge for other mods and by modifying the source for the same version I can place it into the jar and leave all of the stuff added by Forge in (Forge refuses to patch modified classes; that said, I don't directly modify the jar but rather used the steps here).
The main classes to look at are Chunk and ChunkProviderGenerate, which are the only ones you actually need to modify to raise the ground level; after the proper modifications, you only need to change an "added height" variable to adjust the average ground level. Note that I made no changes to actual terrain generation (the shape of the land, biome sizes/locations, etc*), only raised it relative to bedrock.
Note that I also had to modify other things to ensure world generation and mob spawning, etc, worked properly; for example, squid, slimes, and bats have altitude-specific spawning ranges (so do ocelots, but they won't spawn in caves since they require grass/leaves, so I didn't bother changing it; never saw any running around in caves), and many features are limited to y=128 so terrain that is higher than that won't be decorated properly.
You can also look at the source to see how I added in a new world type and switched between my modified generation and vanilla generation; it is actually pretty simple (this is the complete working source for my triple-height terrain mod; I added in comments about what I changed).
NB: This is for 1.6.4 (or earlier); 1.7 made similar changes so terrain can go to the world height limit, although in this case you have to be aware that you can't simply just add a value to the average ground level or higher mountains will be cut off and/or you'll get an ArrayIndexOutOfBounds exception (basically, what I did was double the size of an array use to hold data during terrain generation and simply added a number to the array index when it is calculated; you'd have to reduce the range of terrain in order to do this without going out of bounds, cutting off higher mountains, which can exceed y=128 even in default worlds).
*You can change the layout of terrain itself by editing other classes; for example, in BiomeGenBase you can change the min/max height of biomes, which is what I did for a world I'm currently playing to make things more interesting; I made the normal biomes (except for ocean, plains and swamp) have the max height of X-hills biomes and those in turn higher as well (that is, a desert can have mountains as high as desert hills, which in turn can be higher than normal; for a more extreme example, if you set the height of the ocean biome to that of extreme hills, you'll get the exact same terrain, the min/max height the only difference between biomes). Note that the maximum height of mountains in 1.6.4 is about 64 blocks above sea level, even if you set the max height to a very high number, the practical range is +/- 2.
Also, in GenLayerBiome you can change the list of biomes to change the placement/frequency of biomes (e.g putting the same biome in twice will make it more common).
Okay so for the time beeing i cut off the Out of bounds. Now my whole world is +64 now i found out that everything 0-64 is completely empty and bedrock is at 64-59. removing bedrock wont be that hard. But putting it back and then filling the things inbetween. and after that caves and etc.. this is gonna be quite some work but im loving it. Thxx for the VERY usefull code.
For 1.7.2, I found a much simpler solution that only requires modifying code in one place, in BiomeGenBase:
for (int var18 = 255; var18 >= 0; --var18)
{
int var19 = (var16 * 16 + var15) * var17 + var18;
// Remove normal bedrock generation (added in later)
//if (var18 <= 0 + p_150560_2_.nextInt(5))
//{
// p_150560_3_[var19] = Blocks.bedrock;
//}
//else
//{
(Leave code here alone)
//}
}
// Shifts lower 192 layers of terrain data up by 64 blocks
for (int var18 = 191; var18 >= 0; --var18)
{
int var19 = (var16 * 16 + var15) * var17 + var18;
Block var20 = p_150560_3_[var19];
p_150560_3_[var19 + 64] = var20;
}
// Fills in lower 64 layers with stone and bedrock (normal bedrock generation).
for (int var18 = 64; var18 >= 0; --var18)
{
if (var18 <= 0 + p_150560_2_.nextInt(5))
{
p_150560_3_[(var16 * 16 + var15) * var17 + var18] = Blocks.bedrock;
}
else
{
p_150560_3_[(var16 * 16 + var15) * var17 + var18] = Blocks.stone;
}
}
// Optionally, use this in place of the above for one layer of bedrock
for (int var18 = 64; var18 >= 1; --var18)
{
p_150560_3_[(var16 * 16 + var15) * var17 + var18] = Blocks.stone;
}
p_150560_3_[(var16 * 16 + var15) * var17] = Blocks.bedrock;
Note that since features are generated after this step you don't need to fix any other generation unless you want to change them to reflect the deeper ground.
Also, here is an example of what I was referring to when I said that tall mountains would become cut off if you did this in 1.7.x (pre-1.7.x terrain is limited to 128 blocks, so you can add up to 128 blocks without having any effect, other than fewer tall trees on high mountain peaks), although if you are only doing 64 blocks it shouldn't have much of an effect on non-Amplified worlds as mountains this high (over y=191) are rare:
(here is a link to the thread where I got the seed for that)
Hey, new to the forums, I am interested in lowering the terrain height, to have more height to build, while still maintaining the terrain. How would you modify the code to do that?
This was the result when I applied the changes from the Wedge mod (just those that enabled terrain to go to the world height limit), after some trial and error; what I did here was add 64 to the terrain data and fill in the lower 64 layers with stone and a layer of bedrock at y = 0 (removing the original bedrock, which would otherwise block the lower 64 layers):
Here is a screenshot from the top of a mountain showing a y-coordinate of 181:
For comparison, here is the same world generated with normal terrain (it looks a lot darker because the mapping program makes higher elevations lighter):
I also had to fix up some other things, like change the range of generation in BiomeDecorator and WorldGenSwamp, although there are still some bugs present (e.g. no squid spawn in water since they only spawn below y = 63; a swamp hut generated mostly underwater without stilts).
Of course, I also modified the generation of ores to account for this (doubling the range and the number generated will keep the density the same):
You can see I did something different with the rarer/lower ores, which I had already modified, before doubling the terrain height; the lava level here is 3 (instead of 10 or doubled to 20). Note also that in the genOres methods I added a check for negative y-values, not testing to see if it would crash without it (done because you can't generate fractional veins).
As for why I wanted to do this, check out the height of the caves; I only had to double the y-range in the cave generator to get them to generate to the surface, doubling the number of caves per system in the process to maintain the same density (I also split the height algorithm in two so 50% of caves in a system generate like normal, with more caves lower down, and the other 50% generate uniformly spread out along the y-axis, with a vertical cave running up through the center to the surface); I also did the same with ravines (imagine a 100+ block drop down 2-3 stacked ravines...):
I had actually already done something similar when I modified cave generation in order to get the most of the the available terrain; I reduced bedrock to just one layer and lowered the level of lava in caves from 10 to 3 and lowered the min/max of rarer ores by 7 (so there is the same amount of diamond, etc, above the lava level but less overall, although if you branch mined you'd find the same amount at the corresponding lower layer).
Oh yeah, by changing a single variable I can easily adjust the height of terrain all the way up to the world height limit; for example, add 128 (the max) instead of 64:
(I didn't bother making a larger map here or correcting caves, etc, but it would be easy to pass in a variable to each of the classes that needs to be modified)
I haven't actually tried playing on this kind of world yet, outside of just exploring it in Creative while testing in MCP, but it would be interesting if this could be added as a vanilla world generation option; I call this "Double Height Terrain" (the above would be triple height).
Note also that while the screenshot shows I am using Forge it is only because I use Forge for other mods and by modifying the source for the same version I can place it into the jar and leave all of the stuff added by Forge in (Forge refuses to patch modified classes; that said, I don't directly modify the jar but rather used the steps here).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
https://www.dropbox....ource_1.6.4.zip
The main classes to look at are Chunk and ChunkProviderGenerate, which are the only ones you actually need to modify to raise the ground level; after the proper modifications, you only need to change an "added height" variable to adjust the average ground level. Note that I made no changes to actual terrain generation (the shape of the land, biome sizes/locations, etc*), only raised it relative to bedrock.
Note that I also had to modify other things to ensure world generation and mob spawning, etc, worked properly; for example, squid, slimes, and bats have altitude-specific spawning ranges (so do ocelots, but they won't spawn in caves since they require grass/leaves, so I didn't bother changing it; never saw any running around in caves), and many features are limited to y=128 so terrain that is higher than that won't be decorated properly.
You can also look at the source to see how I added in a new world type and switched between my modified generation and vanilla generation; it is actually pretty simple (this is the complete working source for my triple-height terrain mod; I added in comments about what I changed).
NB: This is for 1.6.4 (or earlier); 1.7 made similar changes so terrain can go to the world height limit, although in this case you have to be aware that you can't simply just add a value to the average ground level or higher mountains will be cut off and/or you'll get an ArrayIndexOutOfBounds exception (basically, what I did was double the size of an array use to hold data during terrain generation and simply added a number to the array index when it is calculated; you'd have to reduce the range of terrain in order to do this without going out of bounds, cutting off higher mountains, which can exceed y=128 even in default worlds).
*You can change the layout of terrain itself by editing other classes; for example, in BiomeGenBase you can change the min/max height of biomes, which is what I did for a world I'm currently playing to make things more interesting; I made the normal biomes (except for ocean, plains and swamp) have the max height of X-hills biomes and those in turn higher as well (that is, a desert can have mountains as high as desert hills, which in turn can be higher than normal; for a more extreme example, if you set the height of the ocean biome to that of extreme hills, you'll get the exact same terrain, the min/max height the only difference between biomes). Note that the maximum height of mountains in 1.6.4 is about 64 blocks above sea level, even if you set the max height to a very high number, the practical range is +/- 2.
Also, in GenLayerBiome you can change the list of biomes to change the placement/frequency of biomes (e.g putting the same biome in twice will make it more common).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
For 1.7.2, I found a much simpler solution that only requires modifying code in one place, in BiomeGenBase:
Note that since features are generated after this step you don't need to fix any other generation unless you want to change them to reflect the deeper ground.
Also, here is an example of what I was referring to when I said that tall mountains would become cut off if you did this in 1.7.x (pre-1.7.x terrain is limited to 128 blocks, so you can add up to 128 blocks without having any effect, other than fewer tall trees on high mountain peaks), although if you are only doing 64 blocks it shouldn't have much of an effect on non-Amplified worlds as mountains this high (over y=191) are rare:
(here is a link to the thread where I got the seed for that)
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
Hey, new to the forums, I am interested in lowering the terrain height, to have more height to build, while still maintaining the terrain. How would you modify the code to do that?