Skip to content

Instantly share code, notes, and snippets.

@tryashtar
Last active December 18, 2018 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tryashtar/094562c6da024159e9fa24f4151a76a2 to your computer and use it in GitHub Desktop.
Save tryashtar/094562c6da024159e9fa24f4151a76a2 to your computer and use it in GitHub Desktop.
/inventory command proposal

First, you pick the inventory:

  • /inventory block <pos> is a block's inventory
  • /inventory entity <targets> is an entity's inventory
    • For players, the "domain" here is the same as /clear -- the entire inventory including armor and off-hand. For other entities, it includes ArmorItems and HandItems. Horses include saddle and armor slots, as well as inventory if applicable.

Then, you pick the action and item:

  • add <item> [<count>] [<slot>] is similar to the current /give -- it adds an item to the inventory.

    • If slot is unspecified, it stacks or adds similarly to picking up an item. If slot is specified and the slot is empty or can stack with the item, it will do so, otherwise it will fail.
    • Unlike the current /give, items are typically placed directly in the inventory instead of appearing as a dropped item.
    • If there are no available slots for a block, the command fails.
    • If there are no available slots for an entity, the item appears as a dropped item similar to the current /give.
  • set <item> <count> <slot> is a replacement for the current /replaceitem. It's the only action which requires a slot.

  • clear [<item>] [<count>] [<slot>] is similar to the current /clear -- it removes items from the inventory.

    • If count is -1, it clears all relevant items from the inventory or slot. Otherwise, it functions as it would in /clear -- clearing only up to that many.
    • If slot is unspecified, it searches the entire inventory. Otherwise, it only tests that slot against the item.
  • query [<item>] [<slot>] returns the number of items found in the inventory or slot, to be used in conjunction with /execute store.

    • If item is unspecified, it returns the total number of items. Otherwise, it returns the number of items that match item.
    • If slot is unspecified, it searches the entire inventory. Otherwise, it only counts the matching items in that slot.

Notes

  • /replaceitem and /clear would be phased out by this command.
  • /give <targets> would become an alias of /inventory entity <targets> add.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment