continuation of how to use
Boba194230 opened this issue · 20 comments
Originally posted by @Boba194230 in #7 (comment)
So I’m revising this because I have a new idea for how to try to use this again(as I’ve met a bit of a roadblock with the terralith devs) I have all of the new biomes from the overworld.json’s from cavernous how would I go about adding them? I’m assuming that if I try to patch it should patch the overworld.json from terralith naturally correct?
So cavernous will be the only thing I’m actually making changes to and I want it to try patching terralith without any edits so I can post this as a compatibility mod
I’ll post all of the new stuff once I get home since I cut them out and saved it to a txt
To answer your last question, currently you do have to make separate add
patches for all of those. (This might change in the future.)
Anyway, I've created some patches based on Cavernous v1.0.2 in an attempt to get Cavernous compatibility working. These include both a noise_settings/overworld.json
patch and a biomes/lush_caves.json
patch. (The process of creating the former being especially involved -- I had to create a small program to format the file in order to find the meaningful differences between it and vanilla.)
There's still the dripstone_caves.json
conflict which you can probably resolve yourself using the lush_caves.json
patch as a reference. I would recommend putting the Cavernous version in some kind of Json formatter so it has the same indention as the vanilla version, and then putting both the Cavernous one and the vanilla one in a diffing application. The reason you'd want to compare against vanilla and not Terralith is because Terralith adds a bunch of its own things which could add extra noise, and because it would be difficult to tell which vanilla things Cavernous is removing. If you make patches against the vanilla stuff, they should also work with Terralith, provided they aren't moving things around.
Another thing to note when assembling the datapack is that you'll want the ordering to be (from top to bottom): The compatibility datapack, Terralith, and Cavernous. That way Terralith's replacements overwrite Cavernous's, so that the compat datapack can patch Terralith's version.
Finally, I didn't manage to get any of Cavernous's biomes generating, so I believe the overworld.json
patch may need some tweaking (I think Terralith's caves are taking precedence).
Would it be possible to use one add function to add everything at once or do I have to do them all separate?
Yeah so I’m going to require patched because I’ve talked with the terralith devs and even though I think that I should be able to have their code their since it wouldn’t do anything they said that it probably wouldn’t be allowed but I want to publicize a patch that people can use without having to do merge the changes manually like I did. As I already have a working version combining the two just manually. I know that doing it this way requires me to manually make the patches but if I can get the method down I’m fine with that as I only plan on maintaining what works on my server. The order in the file didn’t seem to change anything too bad as i did it that way when I manually combined them and it worked great. So in summary I’m trying to make a separate version of cavernous that requires patched to make it work with terralith at runtime without me distributing any of terralith’s code as they frowned at that even when I brought up that clause in the license. Now the head himself didn’t get in touch with me but the other head devs did and said he’d most likely say no and so I’m trying to go about this another way.
Also my bad I thought that the patch for the lush caves was just really long and didn’t notice that it was all of the patches
I’ll probably end up packaging it as a jar instead of zip so only datapack users don’t get confused and think they can use it
and then this one is from data/minecraft/worldgen/noise_settings
changes.txt
honestly i just gave up on the dripstone and lush caves since the main thing changed seemed to be some new carvers and a few new placement things so i just let terralith take over for those.
I have this txt of everything changed in overworld.json in the data/minecraft/dimension folder
changes.txt
but if I'm understanding everything right I might get how to do it from that patch you made, I'll try my hand at making one
hmm aactually i'm really dumb, so I can't just do
"op": "add",
"path": "/surface_rule/sequence/-"
"value": paste the changes.txt since its all one value in sequence
can I?
This is for the noise_settings overworld.json btw.
I found that if I just had everything that specifically said cavernous it worked since I want terralith doing most everything else
ie this as an overlworld.json.patch for noise_settings
overworld.json.patch
sorry if the spacings are all screwed up that happened when I copied them over but it worked looking that way when I had it in the file hardcoded so its probably fine
sorry you had to make that program to check the differences I had done that manually already thats why I said i was going to update those changes.txt files
and the end goal of this is going to be me posting a separate version of the mod with the patch built in already specifically for terralith compatibility, he's given me permission
does it know to make its own commas and stuff for inputting the data into the json? I'm assuming thats part of the add function
So reading your two most recent comments I'm beginning to think maybe I don't fully understand what you're trying to use Patched for. Specifically, are you trying to make a separate version of Cavernous built on top of Terralith (i.e., merging Terralith and Cavernous's overworld.json
s)? Because it sounds like you're trying to use Patched as a way to combine the files outside of the game, which it simply cannot do -- Patched only applies patches at runtime (the library could do this, but you'd have to set up a program to use it, and by then you might as well use some site anyway). It is after all, a Minecraft mod, and not a standalone application.
Basically, my question is: are you going to require Patched to use this version of the datapack, or are the "patches" applied ahead of time (so that it works with vanilla)?
If it's the latter, Patched isn't going to help you (since again, it only works at runtime), and instead you're going to need to merge the changes manually. Patches like these are only going to help you when inevitably Minecraft, Terralith, or Cavernous has an update and all of the sudden you have to rebase your changes. And at this point, you might find that a git repository works better for this purpose (especially if you plan to maintain multiple versions). See also MinecraftForge (and NeoForge)'s big mess of patches for prior art in this area. (It's Java instead of Json, but the same sort of idea applies.) In case you haven't looked into this, one thing you will need to worry about going this direction is redistribution of assets -- in order to have your modified datapack work, you'd need to include Terralith's surface rules and other overworld.json
tweaks, meaning you'd be redistributing part of Terralith. Fortunately, Terralith's license allows you to redistribute "portions" for the creation of "compatibility addons", so you probably wouldn't get into any kind of legal trouble (but IANAL, so...).
If it's the former, then the patch you have will almost work. First, the values don't need to be strings; you can just put the object in there. Patched works by manipulating the Json tree -- it doesn't care about commas, field ordering or indention (that's for the Json parser to deal with, in this case Gson). This means that if you make the value a string, Patched will try to insert a string. The other thing is that there's a good chance inserting at the end is not what you want. I'm fairly certain Minecraft applies the surface rules in order, so you probably want Cavernous's higher, not lower. (Currently, the patch puts Cavernous's stuff after Minecraft's last rule for I think deepslate.) You may have missed it, but I did include an overworld.json.patch
in that gist from earlier (not just a lush_caves.json.patch
).
In conclusion, if you don't want Patched at runtime, you need a different approach. Otherwise, you'll need to fix that overworld.json
patch or else Minecraft is probably going to boot you to the safe mode screen (I really don't think it would like a string in the sequence
array).
Alright so I've managed to get the biomes actually generating. As it turns out Minecraft does actually need the dimension/overworld.json
file too. It sounds like dimension/overworld.json
decides which biomes to put where and worldgen/noise_settings/overworld.json
decides how to generate the biomes. Of course dimension/overworld.json
doesn't exist in vanilla (which is why I think a month ago I thought it was some kind of legacy file), but no, it's just more Mojank. Anyway, here's a patch for that, since making that one by hand is just about impossible (and also I had to make it to test it, so there's no point just letting it go to waste).
Since the reason the biomes weren't generating was because of a missing patch, the ordering probably doesn't matter (like you said). The final datapack-mod-jar-thing should then have, at the very least, a minecraft:dimension/overworld.json.patch
, a minecraft:worldgen/noise_settings/overworld.json.patch
, and the three biome patches. If you went the extra mile to turn all of the files into patches, and not just the ones that conflict with Terralith, then Cavernous could be compatible with other datapacks too.
Finally, since you're planning to package it as a jar, you could make it a mod (just slap an entrypoint-less Fabric mod metadata and a (Neo)Forge lowcodefml
mods.toml
in there) and then you could add an explicit dependency on Patched, which would prevent people from forgetting to install it.
I mean I had all the changes ready(in that txt as that was everything I pasted into it manually) to make the patch for the dimension/overworld.json but I’ll definitely take a look. That’s kinda what I planned on doing for it I was just gonna cross that bridge after I came to it. Like I said though I don’t think I’m really gonna bother with the biome specific ones as the terralith base seems better but maybe I’ll try to at least get the carvers in. Thanks I was more asking if something like what I was looking for was possible but thanks a bunch. There’s a new update coming out in like a week for cavernous and I wanted to learn how to do this and then release mine close to his
Upon looking at that yeah that’s exactly how I was planning to do that. I had gone through a while ago when I did this manually and cut out every set of brackets for a biome relating to cavernous so I was just going to do that but you saved me a bunch of work
And sorry I should’ve made it clearer since that’s how I understood the files to work for the biomes but I must’ve not. That’s why I was specifically stating those files lol