What is the maximum possible size of the Minecraft Java Edition world? Let's say we removed the hard coded limitation of 30,000,000 blocks, would it be able to generate to the 32-bit integer limit limit? 64-bit limit? Or could it theoretically generate farther and farther forever?
Just as a clarification I'm not talking about file size, but rather the distance from 0,0 to the edge in blocks.
The hardcoded limit in vanilla is 30,000,496. Beyond this point, nothing is allowed to appear...chunks are not generated so you would just fall into the void, mobs don't spawn, and all entities are physically stopped (kind of like when they travel into unloaded chunks and then get stuck floating in mid-air when reloaded). Players that are not attached to entities (minecarts, boats, etc) are force-teleported back to 30 million. Mods can extend worldgen and stuff all the way out to 1 billion with no significant performance/logic issues beyond the need for a beefy enough computer, but from there to the 32-bit integer limit things like block lag and strange mob behavior will increasingly pile on until the game crashes outright.
Height is a different number (2^1024) aka a 64-bit floating-point number. This is where Minecraft's concept of infinity begins, and I'm pretty sure it isn't used anywhere else in the game. It's kind of funny that they use a double for an axis that is forced to integer values, but use integers for the horizontal axes that allow floating-point values.
(I have no idea what Mojang was thinking when they write code like this; I fix it whenever I come across it, they do appear to have finally fixed many of these bugs in 1.16 though; search for "Casting issue" on this page). Also, this line of code is from the code that generates ores, which will cause the game to lag or crash when you go too far out, as detailed here)
Also, you do not need a powerful computer to go past 30 million; raw performance only depends on currently loaded chunks, not the total size of a world or how far out you've gone; I removed the limit in my own mods and the game runs perfectly fine, in part due to fixing the aforementioned float casts (for example, gravel doesn't fall properly so falling sand entities build up and cause lag):
All I had to do was remove a bunch of checks for block positions being within 30 million; 1.6.4 otherwise has no limits on how far out chunks can generate (chunks past this point only have terrain, no decorations, entities, etc, and are non-interactive). I removed these checks to improve performance (why make 4 checks every time a block is read or placed?); there is another hardcoded limit of 30 million in the /tp command and you'll automatically get kicked from the world if you go past 32 million, neither of which I removed, and they only indirectly limit the size of the world (same for 1.8+'s world border or 1.7's invisible wall):
public int getBlockId(int par1, int par2, int par3)
if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000)