Is there any way to test if a Players inventory is not full in Minecraft

Is there any way to test if a Players inventory is not full in Minecraft - Road Between Pine Trees

Is there any way to test if a player's inventory is not full (eg. atleast 1 empty slot anywhere in the inventory, not counting Armor Slots) with command blocks and whatnot?



Best Answer

I found /testfor @p {Inventory:[{Slot:0b}]}, which outputs a 1 block signal if there's an item there, and no signal if that slot is empty. This would require 36 command blocks, to check every slot (including the hotbar; 27 to just check the inventory, 40 if you wanted to check armor slots)




Pictures about "Is there any way to test if a Players inventory is not full in Minecraft"

Is there any way to test if a Players inventory is not full in Minecraft - Bird's Eye View Of Roadway Surrounded By Trees
Is there any way to test if a Players inventory is not full in Minecraft - Man and Woman Standing on Giant Chessboard
Is there any way to test if a Players inventory is not full in Minecraft - Full body of concentrated mature man and woman carrying cart with dry hay while walking together along rural path in countryside on sunny day



Can you check player inventory Minecraft?

In Minecraft Vanilla 1.12. 2 you can't look up other player's inventories, you can only test if a certain item is in it. But in 1.13 (and already in the snapshots) you can use /data get entity <player> to get all data of a player. If you add Inventory to it, it only shows the inventory.



Minecraft - Check For A Specific Item NOT Being In The Player's Inventory!




More answers regarding is there any way to test if a Players inventory is not full in Minecraft

Answer 2

This solution works for 1.14 for sure, I have not tested for 1.13. It can be elaborated on to check the entire inventory in one command; however, in this example I am only checking the hotbar.

/execute if entity @p[nbt={Inventory:[{Slot:0b},{Slot:1b},{Slot:2b},{Slot:3b},{Slot:4b},{Slot:5b},{Slot:6b},{Slot:7b},{Slot:8b}]}] run say Hotbar is not full.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: veeterzy, Joshua Welch, Tima Miroshnichenko, Greta Hoffman