cocolabs / cocolib

Simple Minecraft modding library.
GNU General Public License v3.0
0 stars 1 forks source link

Discord ChatReport a BugPlanned Features

About

CocoLib is a Minecraft modding library for Forge that introduces simple and clean solutions to complex problems developers usually encounter when creating Minecraft mods.

Creating mods for Minecraft can prove to be a challenging and at times frustrating experience. Developers are required to have a good understanding of both Java and Forge when implementing more complex mod ideas. In addition to this, working on multiple projects that are trying to implement similar concepts or using similar method to accomplish tasks requires a fair amount of code duplication.

CocoLib does a lot of this for you by providing simple and efficient ways of solving many problems without having to spend an unreasonable amount of time researching implementation practices and resort to code duplication. It tries to do this while maintaining best Java and Forge practices.

Features

Where to get it?

This depends on what you want to use the mod for.

Note that the mod can always be downloaded from Github.

CurseForge

This is the recommended way of obtaining a production jar for library users.

Head on over to the CurseForge page and download the mod from there.

Maven

CocoLib is hosted on JitPack so head over there and get the latest release.

Here is the recommended way of getting the library in your project:

// Definines where Gradle should look for declared dependencies
// Declare this AFTER the buildscript block (first script block)
// and BEFORE MinecraftForge Gradle plugin configuration
repositories {
    ...
    maven { url 'https://jitpack.io' }
}

minecraft {
    ...
}

dependencies {
    // Specify the version of Minecraft to use
    minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"

     // Improve my modding experience!
    implementation "com.github.yooksi:CocoLib:${cocoLibVersion}:dev"
}

Note that the cocoLibVersion property in this example was defined in gradle.properties to make accessing and reading version numbers easier. You should update the property (or just replace the variable) to a fully qualified version of the library you want to use.

The build will try to resolve the deobfuscated version of the library built for use by developers (indicated by the dev classifier) and add it to implementation configuration. This is by far the simplest way of making the library available to your mod during compile and runtime.

Another way to get the library would be to use fg.deobf right after declaring the configuration type to indicate that the production jar should be deobfuscated after being resolved. This is not necessary and just adds extra work during build phase and makes deal with manually attaching source files. This is why the project provides a compiled dev jar.

Github

This is the alternative way to obtain mod jar files. You should only obtain the mod this way if you were instructed to, know what you're doing or are unable to download from both CurseForge and JitPack.

Check the releases section in project repository page to get the latest release.

How to use it?

Developers

Players

Running tests

All test classes can be found in the test module under src/test/java.

Majority of Minecraft mod tests are integration tests and unfortunately Forge doesn't handle well loading classes from different modules in development environment so before running integration tests you should be aware of a couple of things:

License

This library is licensed under General Public License v3.0.

Software that depends on, is built upon or derived from this library is conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved.