Skip to content

Latest commit

 

History

History

mindustryModGradlePlugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

MindustryModGradle Gradle Plugin

Usage

How to add plugin to your mod

For project that forked from Anuke's mod template use this guide

Then:

  • Add this property block in /build.gradle wherever you like (as long as it's done in project evaluation, that is):

    mindustryModCore{
        //...
    }

    Recommended to set project info
    More information about extension

  • Add the line EntityRegistry.register(); (from the genPackage) in your mod class' loadContent() method.

  • Refer to usage for more detailed entity annotation usages.

  • Compile and use the mod as the guide in the mod template says.


Property Configuration

Configuration in gradle.properties

  • mmc.tasks.jarMindustry(default jarMindustry)

    changes name for task jarMindustry

  • mmc.functions.mindustryModCore(default modCoreModule)

    changes name for function modCoreModule(String module)(see addMindustryModCore)

  • mmc.disableKotlinTasks(default false)

    make build faster by disabling kotlin compile tasks
    WARNING: do not set to true in mods that uses kotlin


task jarMindustry

depends on jar. Copies a file to mindustry folders specified in outputDirectories.txt(each line is separated folder) file. If file not exists copies in default mindustry path.

classic - default mindustry path

Comments

Comments starts with # or //

Example outputDirectories.txt

C:\Users\Zelaux\Desktop\Mindustry\server\config\mods
#C:\Users\Zelaux\Desktop\Mindustry\client\mods
classic

mindustryModCore extension

  • projectInfo{ }

  • rootDirectory - directory from which other paths are calculated.

  • assertsPath - path to your assets folder from rootDirectory.

  • assertsRawPath - path to your assets-raw folder from rootDirectory.

  • modInfoPath - path to your mod.(h)json or plugin.(h)json from rootDirectory.

  • rootPackage - your main package.

  • revisionsPath - path to store revision for entity generation.

  • classPrefix - sets class prefix for some generated class like Call, EntityMapping, etc.

    Example from xstabux/Omaloon:
    mindustryModCore{
        projectInfo{
            rootDirectory = rootDir
            assetsPath = "assets"
            assetsRawPath = "assets"
            rootPackage = "omaloon"
            modInfoPath = "mod.json"
            revisionsPath = "revisions"
            classPrefix = "OL"
        }
    }
  • addMindustryModCore()

    Example:
        mindustryModCore{
            addMindustryModCore()
        }  
        dependencies{
            implementation modCoreModule("core")
            implementation modCoreModule("utils")
            implementation modCoreModule("graphics")
        }
  • addArcLibrary()

    • adds repository for ArcLibrary
    • adds method arcLibraryModule(String module)
    Example:
        mindustryModCore{
            addArcLibrary()
        }  
        dependencies{
            implementation arcLibraryModule("utils-io")
            implementation arcLibraryModule("graphics-dashDraw")
        }
  • setupAnnotationProject()

    Prepare project to write AnnotationProcessors

    • Adds task writeAnnotationProcessors
      invokes when you try to compile this project(creates META-INF/services/javax.annotation.processing.Processor)
  • addKaptAnnotations()

    Prepare project to use kapt annotation processors

    Example
    mindustryModCore{
        addMindustryModCore()
        addKaptAnnotations()
    }
    dependencies{
        kapt modCoreModule("annotations")
        kapt project(":annotations")
    }

  • Added custom repository for maven repositories on github

    Example:
    repositories{
      githubRepo("Anuken","MindustryMaven")
      githubRepo("Zelaux","Repo")
    }