Skip to content

Getting started

Crystal Spider edited this page Oct 2, 2024 · 8 revisions

Add as a dependency

Since Cobweb is built on a MultiLoader environment, you can depend on it regardless of whether you use a MultiLoader environment too or not.
If you create your mod with our Mod Generator, Cobweb dependency will already be included, with no further action required!
If that's not your case, fret not, below you can find the steps to follow to use Cobweb in your project!

Note: if you're not using a MultiLoader environment, the root build.gradle and the loader-specific build.gradle are the same, and you don't need Cobweb common module.

Crystal Nest Maven repository

In your root build.gradle add the following repository:

repositories {
  maven { url = "https://jitpack.io" } // Required only for 1.18.2
  maven {
    name = "Crystal Nest"
    url = "https://maven.crystalnest.it"
  }
}

Specify Cobweb version

In your gradle.properties add this line:

cobweb_version = 1.0.0

Make sure to point to the latest version.

Import Cobweb common module

In your common build.gradle add the following dependency:

dependencies {
  implementation "it.crystalnest:cobweb-common:$minecraft_version-$cobweb_version"
}

Import Cobweb loader-specific modules

Fabric

In your fabric build.gradle add the following dependency:

dependencies {
  modImplementation "it.crystalnest:cobweb-fabric:$minecraft_version-$cobweb_version"
}
NeoForge

In your neoforge build.gradle add the following dependency:

dependencies {
  implementation "it.crystalnest:cobweb-neoforge:$minecraft_version-$cobweb_version"
}
The NeoForge module is available since version 1.20.2.
Forge

In your forge build.gradle add the following dependency:

dependencies {
  implementation fg.deobf("it.crystalnest:cobweb-forge:$minecraft_version-$cobweb_version")
}
The Forge module is unavailable since version 1.21.

Declare Cobweb dependency

Depending on the mod loader, you need to declare Cobweb dependency in different ways.

Fabric

In your fabric.mods.json add the following dependency:

"depends": {
  "cobweb": "^${cobweb_version}"
}
NeoForge

In your mods.toml (neoforge.mods.toml since 1.20.5) add the following dependency:

[[dependencies.${mod_id}]]
  modId = "cobweb"
  type = "required"
  versionRange = "[${cobweb_version},)"
  ordering = "AFTER"
  side = "BOTH"
Forge

In your mods.toml add the following dependency:

[[dependencies.${mod_id}]]
  modId = "cobweb"
  mandatory = true
  versionRange = "[${cobweb_version},)"
  ordering = "AFTER"
  side = "BOTH"

Add configuration capabilities

One of the main features of the Cobweb API is its unified configuration system, which allows you to define and register configurations for your mod directly in the common module, eliminating the need for loader-specific code.

However, this feature relies on FCAP. Therefore, to use the Cobweb configuration system, you must also include a dependency on FCAP. Without this dependency, the game will crash when performing any configuration-related tasks.

To add FCAP as a dependency, refer to its wiki and ensure you select the correct version for your Minecraft setup.
For versions 1.20.2 and above, use the neoforgeapi distribution.

For instructions on using the Cobweb configuration system, please see the dedicated section in our wiki.