Skip to content

[1.21.4] opening a double-chest's inventory via player.openInventory() only opens a single-chest sized inventory #11806

@globau

Description

@globau

Expected behavior

Given container is a Container double-chest object, calling player.openInventory(container.getInventory()) should open the double-chest inventory (54 slots). This works as expected prior to 1.21.4.

Observed/Actual behavior

A single chest inventory is opened (27 slots).

Steps/models to reproduce

Here's the full event handler; attach a sign to a double-chest, wax it, then right-click on the sign to open the chest.

From ClodMC:

  @EventHandler
  public void onPlayerInteract(@NotNull PlayerInteractEvent event) {
    if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
      return;
    }

    Block clickedBlock = event.getClickedBlock();
    if (clickedBlock == null) {
      return;
    }

    BlockState blockState = clickedBlock.getState();
    if (!(blockState instanceof Sign sign) || !sign.isWaxed()) {
      return;
    }

    BlockData blockData = clickedBlock.getBlockData();
    if (blockData instanceof WallSign wallSign) {
      Block attachedBlock = clickedBlock.getRelative(wallSign.getFacing().getOppositeFace());
      if (attachedBlock.getState() instanceof Container container) {
        event.setCancelled(true);
        event.getPlayer().openInventory(container.getInventory());
      }
    }
  }

Plugin and Datapack List

Paper Plugins:

  • ClodMC

Paper version

This server is running Paper version 1.21.4-31-main@d0d0efe (2024-12-23T23:53:38Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-15-bb76819 (MC: 1.21.4)

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: apistatus: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.version: 1.21.4Game version 1.21.4

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions