clientcommands icon indicating copy to clipboard operation
clientcommands copied to clipboard

/cfinditem: Add --search-entities flag to search inventories of nearby entities

Open James103 opened this issue 4 years ago • 2 comments

Currently, when you are near an entity and you run /cfinditem, it won't search the inventory of that entity. Some people store their items in an entity's inventory (e.g. a minecart chest), which can easily lead to longer search times because entity inventories are not searchable yet using /cfinditem.

I suggest adding in a --search-entities flag to /cfinditem, that will search the inventories of the following:

  • Yourself (Inventory)
  • Armor Stands (all, HandItems and ArmorItems)
  • Item Frames (all, Item)
  • Minecart with Chest (within player reach, Items)
  • Minecart with Hopper (within player reach, Items)
  • Donkeys (within player reach, Items)
  • Llamas (within player reach, Items)

When the specified item is found in one of those inventories, it should at at least print the following (or something similar): <count>x <item> found inside <entity> at <coordinates>

James103 avatar Mar 03 '21 19:03 James103

You could also look in inventories of other players, though you'd only be able to see their armour, main hand and off hand.

xpple avatar Apr 30 '21 16:04 xpple

A filter could be applied to the --search-entities flag, creating syntax like the following:

/cfinditem --search-entities @e[type=minecraft:horse] minecraft:stone_bricks

Where @e[type=minecraft:horse] is the entity selector that selects which entities to search the inventory contents of, and minecraft:stone_bricks is the item to search for inside the inventories of the selected entities.

For example, if you wanted to know if you have a Totem of Undying in your inventory, you can run /cfinditem --search-entities @p minecraft:totem_of_undying.

James103 avatar Apr 30 '21 17:04 James103