Skip to content
ReinfyTeamPublic

About

Fake Inventory UI by tedo0627 ported to PowerNukkitX.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

FakeInvUI

Fake Inventory UI by tedo0627 ported to PowerNukkitX. A port of InventoryUI by tedo0627, enabling blockless custom inventory UIs backed by a virtual entity.


Features

  • No world blocks placed — Uses a virtual, non-persistent custom entity (inventoryui:inventoryui) instead of placing fake chest blocks in the world.
  • Movement-resilient — Links the virtual container entity to the player (ActorLinkType.RIDING) so the inventory does not automatically close if the player falls or is moved by water.
  • Arbitrary slot counts — Specify any positive number of slots (> 0), including layouts larger than 54 slots with automatic scroll support.
  • Configurable vertical length — Control the visible number of rows (0–6, or null for automatic sizing).
  • Callback & subclass friendly — Handle open, close, click, and tick via lambdas/method references or by extending CustomInventory.

Requirements

  • PowerNukkitX API 3.0.0+
  • Java 25 (JDK 25 required to compile/run)
  • InventoryUIResourcePack — Download InventoryUIResourcePack.mcpack and install it in your PowerNukkitX resource_packs folder with forced resource packs enabled on the server so clients render the custom inventory UI layout.

Installation

Option 1: Standalone Plugin (Library Dependency)

  1. Build the plugin JAR (see Building from Source) or download FakeInvUI.jar from Releases.
  2. Place FakeInvUI.jar into your server's plugins/ folder.
  3. Add FakeInvUI as a dependency in your plugin's @PluginMeta (or powernukkitx.yml):
import org.powernukkitx.plugin.PluginBase;
import org.powernukkitx.plugin.annotation.PluginMeta;

@PluginMeta(
        name = "MyPlugin",
        version = "1.0.0",
        authors = {"YourName"},
        api = {"3.0.0"},
        depend = {"FakeInvUI"}
)
public class MyPlugin extends PluginBase {
}

When loaded as a standalone plugin, FakeInvUI automatically calls InventoryUI.setup(this) during onEnable().

Option 2: Shaded Library (Recommended)

If you embed/shade FakeInvUI directly inside your own plugin, call InventoryUI.setup(this) once in your plugin's onEnable():

import ReinfyTeam.FakeInvUI.InventoryUI;
import org.powernukkitx.plugin.PluginBase;
import org.powernukkitx.plugin.annotation.PluginMeta;

@PluginMeta(
        name = "MyPlugin",
        version = "1.0.0",
        authors = {"YourName"},
        api = {"3.0.0"}
)
public class MyPlugin extends PluginBase {

    @Override
    public void onEnable() {
        InventoryUI.setup(this);
    }
}

InventoryUI.setup(Plugin) is idempotent; calling it multiple times safely returns after the first initialization.

Maven Dependency Coordinates

<dependency>
    <groupId>io.github.reinfyteam</groupId>
    <artifactId>FakeInvUI</artifactId>
    <version>1.0.0</version>
</dependency>

Quick Start

Opening a Custom Inventory with Callbacks

import ReinfyTeam.FakeInvUI.CustomInventory;
import org.powernukkitx.Player;
import org.powernukkitx.item.Item;

public void openShop(Player player) {
    CustomInventory inventory = new CustomInventory(27, "Item Shop");

    inventory.setItem(13, Item.get("minecraft:diamond").setCustomName("§bBuy Diamond"));

    inventory.setOnOpen(p -> p.sendMessage("§aOpened the shop!"));
    inventory.setOnClose(p -> p.sendMessage("§eClosed the shop!"));
    inventory.setOnClick((p, slot, sourceItem, targetItem) -> {
        if (slot == 13) {
            p.sendMessage("§bYou clicked the diamond!");
        }
        return true; // Return true to cancel moving the item
    });

    player.addWindow(inventory);
}

Extending CustomInventory

import ReinfyTeam.FakeInvUI.CustomInventory;
import org.powernukkitx.Player;
import org.powernukkitx.item.Item;

public class SampleInventory extends CustomInventory {

    public SampleInventory() {
        super(54, "Sample Inventory");
        this.setItem(0, Item.get("minecraft:emerald").setCustomName("§aConfirm"));
    }

    @Override
    protected void handleOpen(Player player) {
        player.sendMessage("Inventory opened.");
    }

    @Override
    public void tick(int tick) {
        // Called once per server tick while at least one player has this inventory open
    }

    @Override
    public boolean click(Player player, int slot, Item sourceItem, Item targetItem) {
        // Return true to cancel the interaction
        return true;
    }

    @Override
    protected void handleClose(Player player) {
        player.sendMessage("Inventory closed.");
    }
}

For full class and method documentation, see API.md.


Building from Source

Requires JDK 25 and Maven:

mvn -B package

The compiled plugin JAR will be output to target/FakeInvUI.jar.


Credits & License

Made with ❤️ by ReinfyTeam

About

Fake Inventory UI by tedo0627 ported to PowerNukkitX.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages