#How do you manage multiple versions of a mod?

73 messages · Page 1 of 1 (latest)

void spruce
#

I want to verify what versions of minecraft my mod works on, and for the ones that the mod doesn't work, fix it if it's simple enough.

I would imagine that to keep track of the changes I would need to use a branch for each version/version groups I'm working on.

But if I want to downgrade the minecraft version, do I simply change minecraft version inside fabric.mod.json and that's it? Is there something I should be aware of, or things that I shouldn't do?

Just looking for general dos and donts, even better if it comes from experience (And why).

fallen bronze
#

github branches

#

and u just adjust to errors

#

it depends on the version always

#

for updates that dont break ur code, changing the fabric.mod.json is fine

void spruce
#

Is there somewhere in the docs which matches the fabricloader versions and java versions with the minecraft version?

fallen bronze
#

fabric loader is version independent

void spruce
#

Ooh, so I can stick with the most recent one?

fallen bronze
#

java u shouldnt be going far back enough to worry about

void spruce
#

Fair

fallen bronze
#

fabric loader can stay latest

#

java has been 17 since like 1.18 i think

real maple
# fallen bronze github branches

I do not recommend branches if you want to maintain more than just 2-3 versions. In my experience it takes up a lot of time to merge and switch branches.

fallen bronze
#

please dont say something gross like stonecutter

real maple
fallen bronze
#

and theres really no reason to support more than 3 versions

real maple
#

That's your opinion

fallen bronze
#

bleeding, latest major, and maybe an LTS

#

in this case, 1.21.5, 1.21.1, and 1.20.1 if u feel necessary

void spruce
#

Oh yeah, that reminded me of something. What about the game sources? When I change the version, do I need to generate the sources again, or do they go back automatically when I change the version in the fabric config?

real maple
#

Why wouldn't I support older versions if it's very easy with stonecutter? You say 'support latest', I say if you've already got code working for that version, and you're using stonecutter, it's very simple to keep it working. Most of the time I don't have to do anything

fallen bronze
#

you refresh gradle and gensources again every time u switch branches

void spruce
#

Oof.

fallen bronze
#

you can have each version be in a separate folder

#

its called a workflow system i think

#

a github thing

#

so u dont switch branches and overwrite ur code, u simply open the other project folder and its already generated

#

i havent looked into it much

real maple
#

Anyway, @void spruce . Stonecutter is a relatively popular solution. It allows you to keep all your code on one branch, in one place, and only change the parts that differ between versions. It uses comments to enable/disable parts automatically.

fallen bronze
#

i wouldnt recommend doing that, just code normally

#

it shouldnt be that difficult to switch branches that u need a hacky gradle plugin

real maple
#

Merging is the bigger issue.

fallen bronze
#

leads to some ugly code imo

real maple
void spruce
#

Being fair, if the version will be mostly backported only and not worked on too much, I don't think merging is an issue.

#

Though I'll take a look. If it seems simple enough to setup...

real maple
#

There are also other solutions besides branches and stonecutter. But I don't know them

void spruce
#

Oh god, this is cursed

fallen bronze
#

yeah

real maple
real maple
fallen bronze
#

yeah switching branches is a pita

#

which is why i suggested the workflow setup

#

that might not be the name

void spruce
#

Yeah, stonecutter seems like a simple solution, but it really wouldn't do anything for the sources

fallen bronze
#

but essentially a different folder for every branch

void spruce
#

It feels weird to be making code for version A while code has the sources for version B

fallen bronze
#

stops gradle and sources from breaking

real maple
#

Anyway i also just remembered that it's quite useful if you ever wanna support neoforge. Because you can also so //? if isNeoForge or isFabric

void spruce
#

I mean is that, if I my sources are set to version 1.21.5, but I'm making code for like, 1.20 using stone cutter, and I want to browse the sources for this version I'm coding for, I would still need to generate the sources again it seems.

real maple
#

Not really, often it works to use the correct sources automatically. Sometimes you just need to select them again, and yeah sometimes you need to decompile again.

dapper delta
#

This certainly has some clear disadvantages (such as being a dependency injection nightmare) so I'm not sure I recommend it, but I've been using multiple submodules for this

#

e.g. I have a :common module with shared (non-Minecraft) classes/interfaces, and a :mc1.21.4 that implements those interfaces and initializes the mod for a specific version

fallen bronze
real maple
#

Use multiloader?

fallen bronze
#

subprojects

#

dont use stonecutter for multiloader mods

#

while i dont like it i can see some use for multiversion

#

but it definitely shouldnt be used for multiloader

real maple
cedar raptor
#

stonecutter has a ready to use multiloader multiversion template btw

old frigate
# fallen bronze i wouldnt recommend doing that, just code normally

The main and huge minus of branches is their synchronization. Let's take a situation: You even have 3 branches for different versions of Minecraft, you found several bugs in different parts of the code, and in order to fix it qualitatively you will need to switch to **all **branches, and everywhere write the same fix for **each **bug that you need to remember, and its place in the code

#

With Stonecutter you have one code and you can control it for all versions of Minecraft at once, which greatly reduces the cases where you forgot to sync something somewhere

young warren
old frigate
#

I tried, and it was terrible. After all, I personally find it easier to perceive the code for all versions at once

young warren
#

I've been doing it for a long time with up to 6 branches per mod and I don't find it too difficult but that's just me ¯_(ツ)_/¯

#

to be clear I'm not saying it's better than stonecutter, just that not everyone's experience will be as bad as yours

cedar raptor
#

-# or you just don't make all in one jars as they often are often larger and may confuse users

void spruce
#

I... Did not really understand what you are doing there. It seems like relatively advanced stuff, and I'm not really experienced with fabric or the Java environment.