We've split up the commands, scripting and mods, and add ons category! Please be sure you get your thread in the right place.

11

Command Merge: Inventory

14 Comments

Please sign in to leave a comment.

Sorted by oldest
  • 0
    Registered User commented
    Comment actions Permalink

    Im so used to use /clear

    Only /clear

    Nothing else than /clear ;P

  • 0
    Registered User commented
    Comment actions Permalink

    How about "clear <item> [count]"

  • 0
    Registered User commented
    Comment actions Permalink

    [offtopic comment removed by admin, let's stick to the topic here ~ admin]
    This is a good way to clean up the command system, as each of those commands do similar things.I would like to note, however, that each one is capable a few unique ways of manipulating inventories, and those capabilities ought to persist in the new /inventory command. I will attempt to outline each command's current functionality, the advantages a merged /inventory command would have on each, and what, if any, current workarounds I am aware of to achieve the same goals that this new command system would do more efficiently.

  • 0
    Registered User commented
    Comment actions Permalink

    /give: Arguably the simplest command of the three, it attempts to place the specified item into the player's inventory in the first available slot. Naturally, "/inventory (block/entity) give" would do the same, putting the item into the first available slot in a player or container's inventory, or the given default slot for mobs and other entities. /give also is unique in that it always succeeds (if the target exists), dropping the given item at the player's location if their inventory is full. Therefore /inventory give should also do this, as the current equivalent to this is testing each inventory slot for all possible items (to determine if it is full), and then running /replaceitem in the first slot that returned empty, or summoning the item instead if they all returned full, which is completely impractical to program, and probably not the most efficient performance-wise either. (One could argue that you can just summon the item and let it get picked up by the target, but that only works for players and some mobs.)


  • 0
    Registered User commented
    Comment actions Permalink

    /clear: Currently tests for a specific item irrespective of inventory slots, and then removes the specified number. This would be a very useful feature to extend to blocks and non-player entities, as the current equivalent is to use /data remove (block/entity) and delete the stored inventory, which is a more difficult and complex process, potentially without all the arguments available to /clear. (I don't know enough about inventory editing via /data to be sure, which should be proof enough that it's harder to understand since I know the features of /clear and use it often.) /clear also features the unique ability to test the inventory, once again irrespective of slots, without clearing anything. This is a very useful tool and should be included in the /inventory command, however the way I suggest it be implemented is not specific to the /clear command, and will be discussed later.

  • 0
    Registered User commented
    Comment actions Permalink

    /replaceitem: Sets the prescribed slot to the item specified, regardless of the previous contents of that slot. This is a very powerful command, but is limited in some ways that could be remedied by integration into a /inventory command. I originally was going to make my own post outlining these changes, but they fit so well with this post's suggestion, that I decided to make a comment on this post and boost it instead. Rather than focusing on what /replaceitem can do, I'd like to touch on the things /replaceitem cannot currently do, but are already features of the game, and could easily be implemented in a /inventory command:

  • 0
    Registered User commented
    Comment actions Permalink

    1. /replaceitem is limited to 1 slot. There is no way to apply the command to multiple slots, much less all available slots. The only workaround is to list each possible slot individually, which still limits you to the slots available as selectors. (see below)
    2. /replaceitem cannot access every possible item slot, such as the player's cursor. /clear is able to clear the player's inventory, including the player's cursor, and when clearing no items, is able to detect items as soon as they are picked up by the cursor, without them being assigned to any other slot in the player's inventory (e.g. when clicked on in a chest or other container), so the cursor is a separate slot with separate item storage, at least as long as the player's inventory is open.
    3. /replaceitem only sets the slot to the new item. It cannot add or subtract from existing items. /clear allows one  to remove items, but it operates unlike /replaceitem in that there is no way to specify a slot, so it is imprecise and useless in some applications. There is also no way to use /clear's testing ability on specific slots, which is even more useful, however this can be accomplished using /execute.

  • 0
    Registered User commented
    Comment actions Permalink

    I propose the following additions to the new /inventory command to allow for these features:

    /inventory test: This would function like /clear 0, and allow for checking an inventory for a specified item, as well as being slot-specific, giving more functionality than /clear. Since with the new system, /inventory clear could also be slot-specific, the main difference is that /inventory test can test for a specific item count, where clear 0 can only determine if any number of that item is present. While /inventory test + an optional clear argument or /inventory replace + a none option could /inventory clear completely redundant (and I think either or both of those are elegant solutions and worth including), many people are familiar with /clear, and taking away the convenience of it for a longer and more confusing replacement doesn't seem like a good option.

  • 0
    Registered User commented
    Comment actions Permalink

    /inventory add: This is like a more powerful version of /give, granting the power to place an item in a specific slot, succeeding only if the slot is empty or contains an incomplete stack of the same item. This would allow one to adjust the amount of items in a slot without having to check how many are there. With no item specified, one could even increase or decrease the stack count of any item (as long as the item is stackable) without needing to test for what item is there. (This is also a possible addition to /replace to set the stack count without knowing what item is there.) The main advantage of this, though, is the ability to give the player an item only under the condition that they already have it, irrespective of how full their inventory is, or what the rest of their inventory contains. Since there's no way to currently do this, and the only workaround would be searching for an item via /execute and running a /inventory give (with slot selectors), it seems like a valuable addition.

  • 0
    Registered User commented
    Comment actions Permalink

    slot selectors for /inventory clear/give: (Wouldn't really be necessary if the previously mentioned alternatives were added, leaving /inventory give and /inventory clear as the simplified versions of test, add, and replace) I already touched upon it, but it would make /clear much more powerful if there were optional slot selectors, /give would function almost identically, the optional slot selector allowing one to override which slot is checked, and the item placed into if empty, but since /give drops the item if it fails to place it, it would just go into the first available inventory slot anyway, but it would add a tiny bit of control over what slot the item lands on in some cases.

  • 0
    Registered User commented
    Comment actions Permalink

    Additional slot selectors: There are only three slot selectors missing that I see as vitally important, though there may be others that i am not aware of, specifically regarding containers or entities that I am less familiar with:

    • all: We desperately need the ability to apply inventory edits to every available slot simultaneously. Not only would this save a lot of coding each time a function needed to perform a task to a whole inventory at once, but would also allow one to reach unlisted slots if any are present (see below). This selector would perform the task on the whole inventory collectively, like /clear, and any results would be compiled from every applicable slot. For tasks such as /inventory replace, it would apply to every inventory slot, however tasks like /inventory add would add to the first available slot, and only fail if no slot was available.
  • 0
    Registered User commented
    Comment actions Permalink

    (additional slot selectors cont.)

    • each: Like all, but applies the command to each slot individually. In many cases, this would produce identical results to all but in some, like when using /inventory add, it would run on each slot, adding the specified number of items to every slot it can, and ignoring the others.
    • cursor (cursor, weapon.cursor, inventory.hand, etc): The slot that is holding items when moving them around the inventory or into a crafting grid. /clear currently has access to this, being able to test for and clear items held by the cursor, even before they are placed in the inventory. This would let /inventory replace and all the other functions of /inventory access this slot specifically, which is very useful, both for preventing players from removing items chests and other containers, and their own inventories, and for interesting visual tools that can take advantage of the ability to change the appearance of the cursor by replacing the held item.
  • 0
    Registered User commented
    Comment actions Permalink

    Locked Inventory slots: There is another request here that covers this pretty well so I won't rehash it, but /inventory lock would be another great addition, and fits well with the /inventory syntax established here.

    [End of prior comment. Once again apologies for the many posts, but 1500 characters is not a lot to work with when doing a complete analysis of game mechanics. I would love to know if there's a way to increase that limit in some way, and what the correct protocol is to post long blocks of commentary like this. I try to provide an in-depth analysis of anything I want to be changed, for the benefit of the users interested, and potentially even the developers.]

  • 0
    Registered User commented
    Comment actions Permalink

    WalnutLawyer346

    Good job with that. I agree with pretty much everything you wrote.