2

So basically, I want to create a way to detect when a shulker box is opened, using commands. I've searched everywhere on the internet on how to do so, and I can't find an answer.

1
  • Could you please elaborate so as to what you have already tried doing, also if an answer helps you, don't forget to accept the answer.
    – RyugaGod
    Aug 9, 2021 at 9:16

2 Answers 2

3

You first should add a scoreboard that increases whenever you open a shulker, you can do so like this:

scoreboard objectives add shulker minecraft.custom:minecraft.open_shulker_box

Then, in a repeating command block, or in a tick.mcfunction file, you can put this:

execute as @a[scores={shulker=1..}] at @s run (your command)

And now, so the command only executes once, you can do (also in a repeating command block/tick.mcfunction file):

scoreboard players reset @a[scores={shulker=1..}] shulker
1
scoreboard objectives add opened_shulker minecraft.custom:minecraft.open_shulker_box

All players who open a shulker box will have 1 added to their score.

You must log in to answer this question.

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