I'm making a Minecraft adventure map in 1.13.2 where the player gets a item that can collect information by right clicking on signs or items with it in their offhand. I only know of one way the sign can give a message in chat: /tellraw. However, I don't want it to show the same message if the player doesn't have this item in their offhand.

I have searched for terms like "minecraft different outputs offhand item" and "minecraft rightclick sign offhand item different" but it seems no one else has this same problem. No one else, as I've seen, has explained how this could even be accomplished.

  • 1
    I don't think it's possible at the moment (keyword: think) You used to be able to detect empty inventory slots by testing for air, but now you can't. If you can put exclamation marks before the nbt ([nbt=!..]) then you can use this command to test if there is stone: tellraw @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:stone"}]}] ... and use this at the same to see if there's not: tellraw @a[nbt=!{Inventory:[{Slot:-106b,id:"minecraft:stone"}]}] ... Dec 19, 2018 at 16:21
  • Could I put these two commands in the one sign, though? Dec 19, 2018 at 23:21
  • 1
    You can put up to four different commands in a single sign. Please tell me if you don't know how so I can tell you. Dec 19, 2018 at 23:38
  • Well, I don't know how to do that. Dec 19, 2018 at 23:43
  • 1
    Give me one second for me to make an answer. Dec 19, 2018 at 23:45

1 Answer 1


You'll only need one command to place the sign that will do this. The command is:

setblock ~ ~1 ~ sign{Text1:"{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"execute as @p run tellraw @s[nbt={Inventory:[{Slot:-106b,id:\\\"minecraft:stone\\\"}]}] {\\\"text\\\":\\\"You have stone\\\",\\\"color\\\":\\\"green\\\"}\"}}",Text2:"{\"text\":\"YOUR TEXT\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"execute as @p run tellraw @s[nbt=!{Inventory:[{Slot:-106b,id:\\\"minecraft:stone\\\"}]}] {\\\"text\\\":\\\"You do not have stone\\\",\\\"color\\\":\\\"red\\\"}\"}}"}

Swap hands with stone back and forth and right click the sign. Edit sign text as necessary.

This has been tested well, so if something is wrong please let me know and I will try my best to help.

  • It's a great start! I'm not really sure which parts I'd have to edit though. I'm using a grey stained glass pane as my "scanning device", and the text I would prefer is the following: "You can't collect data, you don't have a scanner!" In red, for when you don't have the glass pane in the offhand "Data has been collected." In yellow, for when you do have the glass pane in the offhand Dec 20, 2018 at 0:14
  • The first part in Text1 has the command execute as @p run tellraw @s[nbt={Inventory:[{Slot:-106b,id:\\\"minecraft:stone\\\"}]}] {\\\"text\\\":\\\"You have stone\\\",\\\"color\\\":\\\"green\\\"}. The second has a similar command of execute as @p run tellraw @s[nbt=!{Inventory:[{Slot:-106b,id:\\\"minecraft:stone\\\"}]}] {\\\"text\\\":\\\"You don't have stone\\\",\\\"color\\\":\\\"red\\\"} and if you scan through it you will easily spot "YOUR TEXT", which is the text you can edit for the second row of text. If you'd like I can edit it myself, but I might have to do it tomorrow. Dec 20, 2018 at 0:17
  • Could you do that for me? Dec 22, 2018 at 22:47
  • Oh, I forgot. Here: setblock ~ ~1 ~ sign{Text1:"{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"execute as @p run tellraw @s[nbt={Inventory:[{Slot:-106b,id:\\\"minecraft:gray_stained_glass\\\"}]}] {\\\"text\\\":\\\"Data has been collected.\\\",\\\"color\\\":\\\"yellow\\\"}\"}}",Text2:"{\"text\":\"YOUR TEXT\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"execute as @p run tellraw @s[nbt=!{Inventory:[{Slot:-106b,id:\\\"minecraft:gray_stained_glass\\\"}]}] {\\\"text\\\":\\\"You can't collect data, you don't have a scanner!\\\",\\\"color\\\":\\\"red\\\"}\"}}"} Dec 23, 2018 at 0:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .