Back to mods
Componency project artwork

Modrinth · Minecraft mod

Componency

A declarative GUI creation library built with/for Kotlin.

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which Componency release matches 1.12.2 Forge?

Updated 2 years ago
beta file 0.3.0+1.12.2-forge
Game version 1.12.2
Loader Forge

Componency 0.3.0+1.12.2-forge targets 1.12.2 with Forge. It must be installed on the client. Do not install it on the dedicated server. No extra mods listed for this file.

Where it goes

Is Componency required on the client, server, or both?

It must be installed on the client. Do not install it on the dedicated server.

Client Required
Dedicated server Not supported
Loader for this release Forge
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

This file is marked client-only.

What else does Componency 0.3.0+1.12.2-forge need?

0.3.0+1.12.2-forge on 1.12.2 Forge. Every mod below is checked against that same setup.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add Componency without breaking your instance.

Built for Componency 0.3.0+1.12.2-forge on 1.12.2 Forge. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use 0.3.0+1.12.2-forge. It targets 1.12.2 with Forge; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    It must be installed on the client. Do not install it on the dedicated server.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside 0.3.0+1.12.2-forge. It opens that exact file at the source.

About this project

What does Componency add?

Componency

A simple, declarative UI library built from the ground up for use in any environment.

wakatime


Discord Badge

Ko-Fi Badge
PayPal Badge
GH Sponsors Badge


Inspiration

Componency is roughly based on 3 other things:

I used concepts taken from all 3 of these projects to create a simple, declarative UI library that can be used in any environment.


Disclaimer

This library is primarily designed for Kotlin, though it does have some additional support for Java.

All the examples from here on out will be in Kotlin, but the library can be used in Java as well.


Set up

Repository

Groovy (.gradle)
maven {
    name = "Deftu Snapshots"
    url = "https://maven.deftu.dev/snapshots"
}
Kotlin (.gradle.kts)
maven(url = "https://maven.deftu.dev/snapshots") {
    name = "Deftu Snapshots"
}

Dependency

Repository badge

Groovy (.gradle)
modImplementation "dev.deftu:componency:<VERSION>"
Kotlin (.gradle.kts)
implementation("dev.deftu:componency:<VERSION>")

Usage

Engine

To use the library at all, you need to create your Componency engine. The engine is responsible for providing Componency with any data it needs and giving it the ability to interact with your rendering system of choice.

package com.example

import dev.deftu.componency.engine.Engine
import dev.deftu.componency.engine.InputEngine
import dev.deftu.componency.engine.RenderEngine
import java.awt.Color

class MyEngine : Engine {

    override val inputEngine: InputEngine by lazy {
        MyInputEngine()
    }

    override val renderEngine: RenderEngine by lazy {
        MyRenderEngine()
    }

}

class MyInputEngine : InputEngine {

    override val mouseX: Float = 0f

    override val mouseY: Float = 0f

}

class MyRenderEngine : RenderEngine {

    override val viewportWidth: Int = 0

    override val viewportHeight: Int = 0

    override val animationFps: Int = 144 // Recommended to be no more than 300

    override fun startFrame() {
        // Start rendering frame (apply any transformations, etc.)
    }

    override fun endFrame() {
        // End rendering frame (apply any transformations, etc.)
    }

    override fun fill(x1: Float, y1: Float, x2: Float, y2: Float, color: Color, radius: Float) {
        // Fill a rectangle with a color and a radius
    }

}

Your UI

Now that you have your engine set up, you can start creating your UI.

object Main {
    
    @JvmStatic
    fun main(args: Array<String>) {
        val engine = MyEngine()
        val ui = MyUI(engine)
        
        // Inside your render loop, you can simply call `ui.render()` to render your UI.
        ui.render() // (This is a placeholder for your actual render loop)
    }
    
}

class MyUI(engine: Engine) {
    
    // Common practice is to use a frame as your root component
    private val frame = FrameComponent().configure {
        // In Componency, we define properties inside their own scope when configuring.
        // The majority of the most commonly used properties have extension variables and functions to make them easier to access.
        properties {
            width = 100.percent
            height = 100.percent
        }
    }.makeRoot(engine) // Finally, we make the frame the root component of this UI by giving it the engine.
    
    private val box = RectangleComponent().configure {
        properties {
            x = 25.percent
            y = 25.percent
            width = 50.percent
            height = 50.percent
            color = Color.RED.asProperty
        }
    }.attachTo(frame) // We make the box a child of the frame.
    
    // From here, you can add more components to the frame or the box.

    // Finally, we provide an external means of rendering our frame.
    fun render() {
        frame.handleRender()
    }

}

Further examples

For more examples, you can check out the basic examples directory. (Java, Kotlin)

Or, if you'd like to implement for LWJGL3, you can check out the LWJGL3 example directory.

Setting up in Minecraft

Both modern and legacy Minecraft versions still require the user of the repository defined in the Set up section. The version number is the same for the Minecraft artifacts as it is for the main library.

Modern Minecraft (1.16.5 and above)

It's as simple as defining the dependency in your build script to use the Componency Minecraft engine in modern Minecraft versions.

Groovy (.gradle)
modImplementation "dev.deftu:componency-minecraft-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>"
Kotlin (.gradle.kts)
implementation("dev.deftu:componency-minecraft-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>")

Legacy Minecraft (1.12.2 and 1.8.9)

We require additional setup for legacy Minecraft versions, as we need to use a dependency management tweaker to ensure that the latest version of Componency is loaded.

Not only does it handle the version of the library, but it also forces Minecraft to use LWJGL 3 to load NanoVG and STB so that our engine can use both for rendering.

Additional instructions for use alongside other tweakers can be found inside the class file itself.

Groovy (.gradle)
dependencies {
    modImplementation "dev.deftu:componency-minecraft-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>"
    modImplementation "dev.deftu:componency-minecraft-tweaker-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>"
}

jar {
    manifest {
        attributes(
            "TweakClass": "dev.deftu.componency.minecraft.tweaker.ComponencyTweaker"
        )
    }
}
Kotlin (.gradle.kts)
dependencies {
    implementation("dev.deftu:componency-minecraft-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>")
    implementation("dev.deftu:componency-minecraft-tweaker-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>")
}

tasks.jar {
    manifest {
        attributes(
            "TweakClass" to "dev.deftu.componency.minecraft.tweaker.ComponencyTweaker"
        )
    }
}

Credits


Coming soon!

  • Debugger


This project is licensed under LGPL-3.0
© 2024 Deftu

Project description from Modrinth.

Pick your setup

Componency by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

24 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

Componency versions and loaders

1 of 24 releases match
Clear filters

Looking for an older file? The official Modrinth project page is in Resources.