Home›Java›Mods›Inventory API
Inventory API
ModsJava

Inventory API

Java mod listed for Minecraft 1.7–1.13. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
Inventory API
​
Ever wanted a simple yet professional way to make your inventories without having to make individual events per item? Well here's your solution, in our custom inventory system we utilize item listeners per item and save your data per item dependent on click type.

Features
​
Examples of API
​
Code (Text):

package com.asylumdevs.inventoryapi.example;

import java.util.Arrays;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.ItemStack;

import com.asylumdevs.inventoryapi.Inventory;
import com.asylumdevs.inventoryapi.InventoryAPI;
import com.asylumdevs.inventoryapi.ItemListener;

public class Example {

    // Opening a blank inventory named "Example" with 1 row.

    public void openBlank(Player p) {
        Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);

        inv.open(p);
    }

    // Opening a inventory with a inventort type named "HOPPER" for the item
    // hopper.

    public void openHopper(Player p) {
        Inventory inv = InventoryAPI.createInventory(ChatColor.translateAlternateColorCodes('&', "Example"),
                InventoryType.HOPPER);

        inv.open(p);
    }
 
    // Opening a inventory with a custom item using our item builder.

    public void openBuilder(Player p) {
        Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);

        inv.setSlot(4, InventoryAPI.createItem("&aClick here!", null, Material.DIRT,
                null, 1), new ItemListener() {
            public void onItemClick(Player p, ClickType click) {
                // Empty doesn't do anything when clicked.
            }
        });
     
        inv.open(p);
    }
 
    // Opening a inventory that replies back with the player's name.

    public void openPlayerName(Player p) {
        Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);

        inv.setSlot(4, InventoryAPI.createItem("&dClick here!", null, Material.HOPPER,
                null, 1), new ItemListener() {
            public void onItemClick(Player p, ClickType click) {
                p.sendMessage(p.getName());
            }
        });
     
        inv.open(p);
    }

    // Opening a custom inventory created

    public void openCustom(Player p) {
        Inventory inv = InventoryAPI.createInventory1(ChatColor.translateAlternateColorCodes('&', "Example"), 9);

        inv.setSlot(4, InventoryAPI.createItem("&dClick here!", Arrays.asList("&fHey!", "&fIf you click here you'll be given one dirt."), Material.HOPPER,
                null, 1), new ItemListener() {
            public void onItemClick(Player p, ClickType click) {
                p.getInventory().addItem(new ItemStack(Material.DIRT));
            }
        });
     
        inv.open(p);
    }
}
 
Problems/Concerns ​

If you have problems or issues, you can send me a private message, or add me over on discord at ASD#4102.
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.

Inventory API is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 189 times (via Spigot). Download it and open it directly in the game.

Explore more