User Tools

Site Tools


client_server_split

[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.

client_server_split.txt · Last modified: 2022/05/19 20:47 by technici4n