Scripts can read and edit containers, but cannot open one for a player. A container screen opens only on the player's own click, or the inventory key while riding.
Proposal (@minecraft/server):
Player.openContainer(target: Entity | Block): boolean
Player.closeContainer(): void
- The server opens the screen as if the player had interacted with target: same distance, permission and chest_obstruction checks.
- Returns false if the target has no inventory, is too far, or another screen is open (like UserBusy in DDUI).
- New ContainerAccessSource value: Script.
- Works for entities with minecraft:inventory and for blocks, including block_entity containers.
Why it is safe: no packets are exposed and nothing is sent on behalf of the client. The server creates the window itself, with the checks a click already has. Scripts can already seat players, show forms and run commands.
Workarounds today:
1. ActionFormData chest imitations: no real items, no drag.
2. Seating the player on an invisible inventory entity and asking them to press the inventory key.
3. A proxy or server plugin that fakes the client's packet: impossible on Realms.
Related: "Force Interaction With Containers In Scripting API" and "/gui Command".
0 Comments
Please sign in to leave a comment.
Post a new comment: