ModsJava
Complex Inventories
Java mod listed for Minecraft 1.8. Downloads from the MC Java Mods app on Android.
⬇ Download on Spigot
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:
public final class Main extends JavaPlugin {
@Override
public void onEnable ( ) {
ComplexInventories. Initialize ( this ) ;
}
}
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 ( ) ;
}
}
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
} ;
}
}
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 ) ) ;
}
}
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 ;
}
}
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
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft version listed: 1.8
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
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.