Home›Java›Mods›Guiy
ModsJava

Guiy

Java mod listed for Minecraft 1.13. Download on the author's site.

⬇ Download on Spigot
[​IMG]
Guiy

Guiy is a general purpose library for creating chest GUIs. It is an easy
way to create navigatable guis with powerful functionality, such as
on click events and user input.

Guiy was written against minecraft version 1.13.2, but should work for higher
versions (and probably lower versions as well). If it doesn't work for something in
1.14 let me know and I'll take a look.

Guiy was made with creative mode in mind, so treats all clicks the same (clients in
creative mode do not distinguish between different types of inventory
click events).

Some Features


Examples
Guiy abstracts the chest GUI into a number of elements. Most elements
wrap other elements to provide additional functionality. A root element
is added to a [code single]GuiHolder[/code], and item holder that passes all click events
through the element tree.

You must register an [code single]InventoryClickEvent[/code] listener in your plugin which
wraps and passes click events to the holder. A simple listener is provided
in [code single]com.derongan.minecraft.guiy.GuiListener[/code]. You can register this if
you want.

Create simple view and swap to a new view
Code (Java):
Layout secondView = ...
Layout firstView = new Layout ( ) ;
Element cell = Cell. forMaterial (Material. DIAMOND_BLOCK, "Button" ) ;
ClickableElement button = new ClickableElement (cell ) ;

firstView. addElement ( 0, 0, button ) ;

SwappableElement swappable = new SwappableElement (firstView ) ;

button. setClickAction (clickEvent -> {
    swappable. swap (secondView ) ;
} ) ;

GuiHolder guiHolder = new GuiHolder ( 6, "Gui with second view", firstView, yourPlugin ) ;

guiHolder. show (player ) ;
Handle numeric user input
Code (Java):
Layout layout = new Layout ( ) ;
Element cell = Cell. forMaterial (Material. DIAMOND_BLOCK, "Submit Number" ) ;
ClickableElement button = new ClickableElement (cell ) ;
NumberInput numberInput = new NumberInput ( ) ;

layout. addElement ( 4, 5, button ) ;
layout. addElement ( 0, 0, numberInput ) ;

button. setClickAction (clickEvent -> {
    numberInput. onSubmit ( ) ;
} ) ;

numberInput. setSubmitAction (number -> {
    player. sendMessage ( String. format ( "You entered %f", number ) ) ;
} ) ;

GuiHolder guiHolder = new GuiHolder ( 6, "Gui with number input", layout, yourPlugin ) ;

guiHolder. show (player ) ;
Use with Gradle
Code (Text):
repositories {
    maven {
        name = 'jitpack'
        url = "https://jitpack.io"
    }
}

dependencies {
    compile group: 'com.github.MineInAbyss', name: 'guiy', version: "master-SNAPSHOT"
}
Use with Maven
Code (Text):
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.MineInAbyss</groupId>
    <artifactId>guiy</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>
Advanced - Protobuf Support
This is probably very specific to the problem I was solving when I made Guiy, but guiy supports Protocol buffer inputs out of the box.

Say we have the following protocol buffer definition:

Code (Text):
package com.something.test.proto;

message Thing {
    enum Color{
        RED = 0;
        BLUE = 1;
        YELLOW = 2;
    }

    Color color = 1;
    double value = 2;
}
We can create an input that will create a message for this type like so:

Code (Java):
// Construct the initial message state. Values will be preserved if unchanged.
Thing thing = Thing. newBuilder ( ). setValue ( 2 ). build ;
ProtobufInput <Thing > protobufInput = new ProtobufInput <> (thing ) ;

thing. setSubmitAction (newThing -> {
    // newThing is a message of type Thing.
} ) ;
Thanks
Many thanks to Daniel Saukel for Headlib, which
makes life so much easier.
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Guiy is a free Minecraft Java mod. Compatible with Minecraft 1.13. Downloaded 120 times (via Spigot). Download it and open it directly in the game.

Explore more