Skip to content

Configuration Guide

Natan Vieira edited this page Aug 16, 2026 · 46 revisions

This guide covers all configuration options available. Use these options inside onInit(...) to define how a view behaves, looks, and interacts with players.

Per-Player Configuration

If you need to adjust the configuration per player—for example, changing the title only for a specific player—you can use modifyConfig inside onOpen. All configuration options available in onInit are also supported on a per-player basis within onOpen.

@OverridepublicvoidonOpen(OpenContextopen) {
open.modifyConfig().title(String.format(
"Hi, %s", open.getPlayer().getName()
));
}

Inventory Appearance & Structure

Options that define how the inventory container itself is created.

title(String label)

Sets the initial title of the inventory.

Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.title("Write something");
}

title(Component label)

Sets the initial title using an Adventure Text Component.

Note

To use Adventure components as titles, make sure the inventory-framework-platform-paper module is on your classpath. See the Installation guide for details.

Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.title(Component.text("Write something")
.color(NamedTextColor.BLUE));
}

size(int slots) / size(int lines)

Sets the inventory size.

You may specify:

  • Number of lines → size(4)
  • Absolute number of slots → size(45)
Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.size(4); // 4 lines (36 slots)config.size(45); // explicit number of slots
}

maxSize()

Automatically sets the inventory to the largest size allowed by its type.

Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.maxSize();
}




type(me.devnatan.inventoryframework.ViewType type)

Defines the underlying container type (e.g. ANVIL, HOPPER, DISPENSER…).

Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.type(ViewType.SHULKER_BOX);
}

layout(String... pattern)

Defines the structural layout of the inventory.
Each character in the array represents a slot, and each string corresponds to a row in the layout.

See Layouts for more details.

Player Interaction Rules

Controls how players are allowed to interact with the inventory.

cancelInteractions()

Shortcut to cancel all interactions.

cancelOnClick()

Cancels all click interactions. Prevents items from being moved.

Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.cancelOnClick();
}

cancelOnDrag()

Cancels dragging items across slots.

Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.cancelOnDrag();
}

cancelOnDrop()

Cancels item drops while the inventory is open. To cancel pickups see cancelOnPickup.

@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.cancelOnDrop();
}

cancelOnPickup()

Cancels item pickup while the inventory is open. To cancel drops see cancelOnDrop.

@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.cancelOnPickup();
}

interactionDelay(Duration delay)(experimental)

Adds a delay before any interaction becomes valid. Actions performed before the delay ends are cancelled.

Preview
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.interactionDelay(Duration.ofSeconds(3));
}

In the example video, the player clicks multiple times, but all interactions are delayed by 3 seconds.

Update & Lifecycle Behavior

scheduleUpdate(long intervalInTicks) / scheduleUpdate(Duration interval)

Schedules periodic updates for the inventory. Triggers onUpdate(Context) automatically.

@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.scheduleUpdate(20L); // every 1 secondconfig.scheduleUpdate(Duration.ofSeconds(5)); // every 5 seconds
}

See Scheduled Updates for more details.

scheduleUpdate(TimerState timerState)

Same as above, but driven by a Timer State instead of a fixed tick count — the interval can be changed and the timer paused/resumed at runtime.

privatefinalTimerStatetimerState = timerState(20L);
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.scheduleUpdate(timerState);
}

Note: experimental (@ApiStatus.Experimental).

Advanced Configuration

with(...) / use(...)

Adds configuration modifiers — internal advanced options.

transitiveInitialData(boolean isTransitive)

Controls whether initial data is passed when navigating between inventory.

  • false (default): data from View A does not transfer to View B
  • true: data from A is carried over to B
@OverridepublicvoidonInit(ViewConfigBuilderconfig) {
config.transitiveInitialData(true);
}

See Navigating Between Views for more details.

Welcome to the Inventory Framework documentation.

▶️ Introduction

🧩 Core Topics

💡 Built-In Features

🧰 Extra Features

🤓 Advanced Usage

⚙️ Internal Mechanisms

🛠️ Tooling

You can find practical examples in the examples directory.

Clone this wiki locally