Skip to content

Add configurable ender chest and shulker box slot counts#13733

Open
cev-api wants to merge 2 commits intoPaperMC:mainfrom
cev-api:shulker-ender-capacity
Open

Add configurable ender chest and shulker box slot counts#13733
cev-api wants to merge 2 commits intoPaperMC:mainfrom
cev-api:shulker-ender-capacity

Conversation

@cev-api
Copy link
Copy Markdown

@cev-api cev-api commented Mar 30, 2026

This adds configurable slot counts for ender chests and shulker boxes.

Summary:

  • adds misc.ender-chest-slot-count and misc.shulker-box-slot-count to GlobalConfiguration
  • normalizes both values to multiples of 9 between 9 and 54
  • updates ender chest menu creation to use the correct container row count and menu type
  • updates shulker box storage and menu creation to support non-default sizes
  • updates CraftContainer handling so non-27-slot shulker boxes open with the appropriate generic chest menu

Reasoning:
Ender chest and shulker box capacity changes are difficult to implement cleanly at the plugin layer, because the underlying container size, menu type, and inventory view handling all need to stay in sync. In practice, plugins that provide larger ender chests or shulker boxes often have to emulate the inventory with separate storage and custom handling rather than using the native container directly. This leads to repeated re-implementation of the same behavior across many plugins and increases the likelihood of edge cases such as desync or duplication issues. This change provides a built-in implementation for that customization while preserving the default 27-slot behavior.

Testing:

  • built Paper successfully
  • rebuilt patches successfully
  • verified default behavior remains 27 slots
  • verified custom values open with the correct menu size
  • verified values are clamped and normalized to supported multiples of 9

@cev-api cev-api requested a review from a team as a code owner March 30, 2026 15:33
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Mar 30, 2026
@masmc05
Copy link
Copy Markdown
Contributor

masmc05 commented Mar 30, 2026

Ender chest and shulker box capacity changes are difficult to implement cleanly at the plugin layer

It's not difficult at all to replace default ender chest inventory with custom inventory that saves items in PDC. You can ask for help in discord if you'd like, but I doubt paper would start becoming more like purpur by adding such features

@cev-api
Copy link
Copy Markdown
Author

cev-api commented Mar 30, 2026

Ender chest and shulker box capacity changes are difficult to implement cleanly at the plugin layer

It's not difficult at all to replace default ender chest inventory with custom inventory that saves items in PDC. You can ask for help in discord if you'd like, but I doubt paper would start becoming more like purpur by adding such features

A PDC-backed inventory is still a custom replacement for the native container. Supporting this natively removes the need for faux-inventory plugins, avoids repeated implementations of the same feature, and reduces the desync/duplication risk that comes from emulating container behavior in plugin code.

@electronicboy
Copy link
Copy Markdown
Member

While doing it in the server is the only real way that entirely makes sense, we're generally not too happy with breaking the vanilla save layout, we expect people to be able to take their save data back to vanilla without any real issues

@cev-api
Copy link
Copy Markdown
Author

cev-api commented Mar 31, 2026

While doing it in the server is the only real way that entirely makes sense, we're generally not too happy with breaking the vanilla save layout, we expect people to be able to take their save data back to vanilla without any real issues

This would be an opt-in non-vanilla feature, so any incompatibility when switching back to the standard server would result from an intentional server-side choice. Thus if a server enables larger native containers and later returns to software that only supports the default storage layout, loss of data beyond those limits seems like an expected consequence of that transition.

case 54:
return net.minecraft.world.inventory.MenuType.GENERIC_9x6;
default:
throw new IllegalArgumentException("Unsupported shulker inventory size " + inventory.getSize());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of throwing new IllegalArgumentException("Unsupported shulker inventory size " + inventory.getSize()), it would be better to return net.minecraft.world.inventory.MenuType.SHULKER_BOX and log a warning such as LOGGER.warn("Unsupported shulker inventory size {}, using the default value.", inventory.getSize());. This makes the code more compatible and resilient by falling back to a safe default instead of failing completely.

Copy link
Copy Markdown
Author

@cev-api cev-api Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested invalid config values locally. These are normalized during configuration load before they reach CraftContainer, so -52 became 9 for ender chests and 992 became 54 for shulker boxes, with startup warnings logged. Because of that, unsupported sizes should not occur through normal configuration, which is why I left the IllegalArgumentException in place here rather than silently falling back to a potentially mismatched menu type.

[15:30:56 WARN]: [io.papermc.paper.configuration.GlobalConfiguration] Invalid misc.ender-chest-slot-count value '-52', using '9'. Valid values are multiples of 9 between 9 and 54.
[15:30:56 WARN]: [io.papermc.paper.configuration.GlobalConfiguration] Invalid misc.shulker-box-slot-count value '992', using '54'. Valid values are multiples of 9 between 9 and 54.

I also tested reducing the configured size after storing items. In that case, items outside the reduced container size were not recovered after increasing the size again and restarting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

4 participants