I actually only use JBE to make the simple edits needed to change cave generation to that in 1.6.4, which involves changing only a couple hardcoded values, and otherwise I have hardly any experience with working with bytecode (I just find the class by using Java Decompiler, then I search for particular strings, then in JBE I look for the right sequence of instructions; there are three consecutive calls Random.nextInt where the "size" of a cave system is determined (line 213, with the "chance" being on line 214; the values of 15 and 7 are 40 and 15 in 1.6.4) and this is not obfuscated so it is pretty easy to spot in the bytecode).
Everything else, including TMCW, is ordinary Java code with MCP used as a development environment (it decompiles and deobfuscates the entire game so you have access to everything; most of my code is in my own classes with the appropriate vanilla base classes modified to call them; e.g. WorldProvider sets up the chunk generator (changed from ChunkProviderGenerate to ChunkProviderTMCW) which in turn calls most other worldgen classes (the vanilla cave generator is MapGenCaves and MapGenRavine; I replaced both with MapGenCavesRavines, which also merges code in a base class, MapGenBase).
For example, here is my "MapGenStronghold" class (from the latest version) which is basically copied from vanilla's with changes to "canSpawnStructureAtCoords" and "getNearestInstance" (the latter method is the one where the overflow occurred; I fixed it by not doing the calculation unless it was within 256 chunks of 0,0 or the result was less than 65536, which is well outside of a 128 + 40 (168) chunk radius). The 1.7.10 version uses all original MCP named classes while I renamed many of the classes in TMCW but they are functionally the same (calling a new class requires editing or replacing the class(es) that call it, which in this case would require editing the "main" class used for generating chunks in the Overworld). For the 1.7.10 version I also had to duplicate some code between the cave/mineshaft/stronghold classes as in TMCW I pass in references to the generators into the constructors so their spawning methods can be called; e.g. caves and mineshafts check for strongholds nearby and mineshafts also check for caves nearby.
However, is there any plans to update this to 1.13.2? Would love it if there were any. Also, dont think there is any info on the page about how to change the spawn rate of caves in the mod, only the download link and the results.
Hi, I just found this mod and was trying it out on 1.13 (I realize that this is not updated to 1.13.2, any plans of that in the future?), and I was unable to find the custom "release" on the minecraft launcher, what could be the problem? I followed all the steps shown and it did not work.
I also saw your thread on reddit about disabling caves, and when I try editing the class file by myself, vbe shows this message when I try to save the changes:
"\Desktop\1.13_oldcaves.jar!bvz.class (The system cannot find the file specified)"
Also I cant seem to find anything on this thread to show how you modify the cave spawns on the mod, or am I just missing it?
EDIT 2: I found out that the file name I was using wasnt compatible with minecraft. Should have known. *facepalm* However, the question in the 1st edit still stands, how do i modify the cave spawns?
You have to use the exact name that I gave, "1.13_oldcaves", or change the name of the json file and the "id": "1.13_oldcaves" line inside, and I'm not sure if spaces are allowed (Java has issues with certain characters in general).
As far as modifying caves, I just changed couple values, though since 1.13 it is much more complicated, requiring editing actual bytecode instead of just changing a number, to change the "chance" of caves, as seen on the right side (I actually wrote a method that did what I wanted, compiled it, then copied its bytecode over; I added the "nop"s so the size of the method is the exact same size (the second column of numbers from 0-18) as otherwise the game crashes due to a "bad stackmap" or similar error. The default chance for 1.13, defined elsewhere, is 0.142857 or 1/7, while 1.6.4 is 0.0666667 or 1/15):
Another value I changed controls the size range of cave systems, 15 (0-14) in 1.7 and 40 (0-39) in 1.6.4, which is set on the first line shown below (overall this means that 1.6.4 has 30% more caves and 20% more volume, which is less of a difference due to more overlap between caves. In general, for the same overall cave density a lower chance and higher size increases regional-scale variation and vice-versa and the average number of caves per chunk is (chance * (size - 1) / 8 * 1.375), or 0.34375 for 1.7 and 0.446875 for 1.6.4):
Of interest, the chance of caves is now set individually for each biome (all are the same), meaning that you could possibly make each biome have a different cave density, if not size (simply increasing the chance by 30%, matching the difference between 1.7 and 1.6.4, will not give the same results, thus even if the chance will be able to be set with data-driven world generation changing the size with mods will still be required, though it would be a lot simpler to do):
(also, the chance of mineshafts is 0.004 (0.01 in 1.6.4), which is line 48, and the chance of ravines is 0.02, set on line 52, so these can also be changed, but you'd need to edit 50+ files unless you modified their generator classes as I did with caves)
Also, I found the correct class by using JD-GUI to decompile the jar and searched for "nextInt(15)", which will give many results but the correct class will look like the following (after nextInt(15) there will be nextInt(16), followed by nextInt(nextInt(120) + 8), another nextInt(16), then nextInt(10) a bit later on):
You could also make other changes; for example, the radius variance of circular rooms is set on line 38, ranging from 1-7, corresponding to a radius of 2.5-8.5 (1.5 is internally added to this value) and diameter of 3-17 blocks; and the maximum width of tunnels is set on lines 48-50, with most being between 0-3 (diameter of 3-9 blocks) and a 1/10 chance of this being multiplied by 1-4 for a maximum of 12 (27 blocks; the width distribution is very highly nonlinear). The 1.375 factor in the cave density calculation mentioned above is due to the fact that there is a 1/4 chance of a circular room (set on line 35) and each one has 0-3 additional tunnels (line 40, with 34 setting the baseline to 1), leading to 0.25 * 1.5 = 0.375 extra tunnels. More advanced changes could be made (in TMCW I alter the values of about a dozen different variables on a regional basis) though without MCP it is a lot more difficult to do anything beyond changing values, especially since the bytecode has to be the same size as the original (this may be because JBE was written for Java 5; I tried changing the chance of mineshafts in a similar manner as caves but JBE malfunctioned, likely because the method has Java 6+ bytecode present).
I don't have the incentive to update these anymore; I've never even used them myself since I only play in 1.6.4 (I haven't even run any vanilla version since 1.13, which was just to test the 1.13 version of "old caves"), and since 1.13 it has become much more complicated to update even a simple mod like "old caves" due to changes to the code (I can't even use MCP, even for older versions that have it, since 1.10 from that I've seen). Forge is entirely out of the question; there is a reason why I never learned how to use it (see: Replace cave generator in Forge; if you want to actually modify existing code, a major part of my own mods, you have to hack into it with ASM bytecode manipulation and stuff like that).
It should be easy for somebody else to update/make them though, and there have been Forge mods that changed cave generation, though the ones I know of that simply changed vanilla caves (example) haven't been updated (not that I know of many such mods since I hardly pay attention to the modding scene despite being a modder myself; the only mods I've used for over 5 years are all my own; likewise, I am barely known outside of places like these forums, soon to be not at all; even my flagship mod, TMCW, hardly shows up in Google searches):
Vanilla since 1.7; variable names have been renamed. "size" ranges from 0-14 and "chance" is 1/7, both averaging 0.25. Note that 1.13 replaced the second line with "rand.nextFloat() < chance", where chance is set in the constructor and defaults to 0.142857 (to make the 1.13 mod I modified a separate method which calculated whether caves should generate to override the field).
int size = rand.nextInt(rand.nextInt(rand.nextInt(15) + 1) + 1);
if (rand.nextInt(7) != 0) size = 0;
Vanilla prior to 1.7; "size" ranges from 0-39 and "chance" is 1/15, both averaging 0.325 (30% more caves; individual cave systems are about 2.8 times larger and more varied in size). Chance in 1.13+ would be 0.0666667; due to this change (nextFloat() does not pull the same bits as nextInt(), the latter of which may also pull more than one random value from the internal generator per call), and a rearrangement of Random calls, caves in 1.13 are not the same as before (it would be possible to revert the changes back so they generate exactly the same as before, so seeds for 1.6.4/1.7-1.12.2 would work. The actual cave generation/carving code has not changed).
int size = rand.nextInt(rand.nextInt(rand.nextInt(40) + 1) + 1);
if (rand.nextInt(15) != 0) size = 0;