User Tools

Site Tools


drafts:client_server_split

This is an old revision of the document!


[WIP]

Make sure you are at least using Fabric Loader version 0.14, and Fabric Loom version 0.12.

To split split and common code, add the following to your build script.

loom {
    splitEnvironmentSourceSets()
 
    mods {
        your_mod_id_goes_here {
            sourceSet sourceSets.main
            sourceSet sourceSets.client
        }
    }
 
    /* other stuff */
}

Then all client-only code can go in src/client/java, and the code that is both on the client and the server can go in src/main/java. Client-only code will be able to reference code in main and code that is only available in client distributions of Minecraft, but main code will not be able to.

drafts/client_server_split.1694632437.txt.gz · Last modified: 2023/09/13 19:13 by nebelnidas