Download ImproperUI — Minecraft Mods — MetaMods
ImproperUI

ImproperUI

Active

Downloads

22

Last update

2 months ago

Versions

1.20 — 1.21.11
Client
Fabric
Game mechanics
Libraries
Utils

ImproperUI

Overcome the complexities of creating interfaces in Minecraft with this unique library! ImproperUI offers a revolutionary approach to developing game GUIs using CSS-inspired syntax.

What is ImproperUI?

This specialized library dramatically simplifies the process of creating custom interfaces in Minecraft. Instead of complex rendering programming, you get a powerful tool with intuitive syntax.

Interface demonstration

The screenshot shows an interactive screen with draggable and scrollable elements created using ImproperUI Script

Knowledge Requirements

For effective work with ImproperUI, basic knowledge is required:

  • CSS basics and property principles
  • HTML structure
  • Java programming language

Recent Updates

Version: 0.0.6-BETA

Added:
  - added ConfigReader
  - added ImproperUIAPI.getConfigReader()

Patches:
  - fixed improper processing of configuration integer arguments

Getting Started

Library Connection

Download the JAR file and add it to the project as a dependency in build.gradle:

dependencies {
    compileOnly files("libs/ImproperUI-desiredVersion.jar")
}

API Initialization

In your mod's main class, call the init() function on ImproperUIAPI:

public class YourModInitializer implements ModInitializer {

    @Override
    public void onInitialize() {
        ImproperUIAPI.init("yourModId", YourModInitializer.class,
                "assets/yourModId/improperui/yourscreen1.ui",
                "assets/yourModId/improperui/yourscreen2.ui"
        );
    }
}

Important: When parsing scripts, specify the file name, not the full path!

Working with Events

To handle events from scripts, create a class implementing CallbackListener:

public class CustomHandlers implements CallbackListener {

    @CallbackHandler
    public void sendGreeting(MouseEvent e) {
        if (e.input.isDown())
            ChatUtils.sendMessage("Hello world");
    }
}

In the script, the event will look like this:

element {
    on-click: sendGreeting
}

Helper Methods

Helper Methods:
  - ImproperUIPanel.collect() // list of all elements and widgets, including children
  - ImproperUIPanel.collectOrdered() // sorted list by z-index
  - ImproperUIPanel.collectById() // elements by specified ID
  - ImproperUIPanel.collectByClassAttribute() // elements by class

API:
  - ImproperUIAPI.parse() // parses script and returns elements
  - ImproperUIAPI.parseAndRunFile() // parses and runs registered file
  - ImproperUIAPI.parseAndRunScript() // parses and runs script
  - ImproperUIAPI.reload() // reloads API
  - ImproperUIAPI.reInit() // reinitializes API

Configuration Keys

Configuration key consists of three parts: modId, confileFile, propertyName. Used for saving setting values.

In script:

slider #someId -yourModId:config.properties:testing-slider-value -someAnotherAttributeClass {

}

Available Elements

Element Dynamic States Children Support Configuration Aliases Specific Properties
element e, div
checkbox active:boolean
radio active:boolean
button
link a href:string
slider min:double max:double value:double
input textbox pattern:quote placeholder:quote
textfield textarea
label textlabel
header1-6 h1-h6
positionable

Script Example

div #background-gradient {
    size: 100%
    margin-top: 100%
    shadow-distance: 50%
    shadow-color: #9775a6
}

div #display {
    size: 420 240
    center: both
    border-radius: 10
    border-thickness: 1
    border-color: #412752
    background-color: #2d162c
    shadow-distance: 5
    shadow-color: #683a68

    child-align: grid
    grid-columns: 1

    div #title {
        inner-text: "ImproperUI Interactives"
        size: 100% 10
        text-align: center
        text-scale: 1.69
        text-color: #9775a6
        background-color: none
        margin-top: 15
    }

    div #motto {
        inner-text: "We got CSS in Minecraft before GTA 6"
        size: 100% 10
        text-align: center
        text-scale: 0.8
        background-color: none
        margin-top: 10
    }
}

This script creates an interactive interface with a title, navigation panel, and draggable blocks, demonstrating the full power of ImproperUI.

Project members
ItziSpyder

ItziSpyder

Developer

Created: 9 May 2024

ID: 4541