Home›Java›Mods›Complex Inventories
Complex Inventories
ModsJava

Complex Inventories

Java mod listed for Minecraft 1.8. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
[​IMG] ​
This API allows you to make super light-weight GUI's with extreme power! You can make static GUI's, animated GUI's (for if you're showing a live playercount or just wanna be fancy)! You can use many things, you can also integrate this API in your plugin and make all of your GUI's run on this power engine! It's called "Complex" for a reason...

Step-by-step on how to initialize, create and use the API!

Spoiler: Step 1: Initialize the library in Main
This is how you initialize the libary:
Code (Java):

public final class Main extends JavaPlugin {

    @Override
    public void onEnable ( ) {
        ComplexInventories. Initialize ( this ) ;
    }
}
Spoiler: Step 2: Create the GUI instance
Spoiler: For an animated GUI
Let's take for instance that you create a GUI for in your hub, this is how what you need to add in your hub class:
Code (Java):
public class Hub {
    public Base complexInventory ;

    public Hub (JavaPlugin plugin ) {

        plugin. getCommand ( "open" ). setExecutor ( new TestCommand ( this ) ) ;

        complexInventory = new Base (plugin ) {
            @Override
            protected ComplexInventory <? extends Base > buildScreen (Player player ) {
                return new TestScreen <> (getPlugin ( ), this, "Title", player, 54 ) ;
            }
       
            @Override
            public void updateScreen ( ) {
                for (ComplexInventory <? extends Base > page : getPageMap ( ). values ( ) ) {
                    if (page instanceof TestScreen )
                        ( (TestScreen <? extends Base > ) page ). buildPage ( ) ;
                }
            }
        } ;
    }

    @EventHandler
    public void refreshScreen (RefreshEvent event ) {
        if (event. getType ( ) != RefreshType. ONE )
            return ;

        complexInventory. updateScreen ( ) ;
    }
}
Spoiler: For a static GUI
Let's take for instance that you create a GUI for in your hub, this is how what you need to add in your hub class:
Code (Java):
public class Hub {
    public Base complexInventory ;

    public Hub (JavaPlugin plugin ) {

        plugin. getCommand ( "open" ). setExecutor ( new TestCommand ( this ) ) ;

        complexInventory = new Base (plugin ) {
            @Override
            protected ComplexInventory <? extends Base > buildScreen (Player player ) {
                return new TestScreen <> (getPlugin ( ), this, "Title", player, 54 ) ;
            }

            @Override
            public void updateScreen ( )
            { } //Only if u have an animated GUI
        } ;
    }
}
Spoiler: Step 3: The page class for the GUI
Code (Java):
public class TestScreen <BaseType extends Base > extends ComplexInventory <BaseType > {
    public TestScreen (JavaPlugin plugin, BaseType type, String name, Player player, int slots ) {
        super (plugin, type, name, player, slots ) ;
        buildPage ( ) ;
    }

    @Override
    protected void buildPage ( ) {
        clearPage ( ) ;
        addItem ( 4, new Item (Material. GRASS, "" + GREEN + BOLD + "Grass Item", 1, true ) ) ;
    }
}
Spoiler: Step 4: How to open the GUI for a player
I'm gonna be using a simple command to do that:
Code (Java):
public class TestCommand implements CommandExecutor {
    private final Hub hub ;

    public TestCommand (Hub hub ) {
        this. hub = hub ;
    }

    @Override
    public boolean onCommand (CommandSender sender, Command command, String label, String [ ] args ) {
        hub. complexInventory. openScreen ( (Player ) sender ) ;
        return true ;
    }
}
Spoiler: Step 5: Result of executing the command
[​IMG]

Plugin details

Read from the plugin's own plugin.yml.

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.

Complex Inventories is a free Minecraft Java mod. Compatible with Minecraft 1.8. Downloaded 75 times (via Spigot). Download it and open it directly in the game.

Explore more