How to use QueryOperation forms of depricated inventory#query methods?s?

Either its so simple I’m nearsighted at the approach to use, or its really something a bit more involved, but I am wondering how to come up with the equivalents of the various inventory#query() forms that are depricated in Api 7.1.0 and say to use the #query(QueryOperation) form…

Given that I have an itemstacksnapshot object called “usedTool”, an inventory object “playersInventory”, and my wanting to query the player inventory for any tool match that is the same basic type (ie, I don’t care about lore, enchantments, data, names, damage…) when producing a new 'sub-'inventory set, I would use:

Inventory matching = playerInventory().query(usedTool.getType()) ;

Being depricated, this process works fine right now and does the job, but I would like to figure out how to do that same process with the QueryOperation ones.

What would the equivalent method be?

Inventory matching = playerInventory().query(QueryOperationTypes.ITEM_TYPE.of(usedTool.getType()));
1 Like

Thanks pie - you rock, and lead the way to experiment for the other queries now :slight_smile: