This was a trick he did, he's simply hollowed out the area behind the portal and filled it with netherrack.
If you watch the entirety of the clip you see a creeper spawn in the area, as it is still part of the overworld.
This is possible somewhat easily since 1.13 thanks to /execute store
.
As a preparation, you need some scoreboard:
/scoreboard objectives add temp dummy
Then you need the value 1 somewhere. Here I set it for the dummy player #1
(which can't be a real player name and does not appear in scoreboard displays):
/scoreboard players set #1 temp 1
When you actually want to decrease the item count, first store the amount in a scoreboard:
/execute store result score @s temp run data get block ~ ~ ~ Items[{Slot:0b}].Count
I specifically check for Slot:0b
instead of simply using the index (Items[0]
) as a workaround of a bug.
Now you need to subtract 1:
/scoreboard players operation @s temp -= #1 temp
And store it back to the chest's NBT.
/execute store result block ~ ~ ~ Items[{Slot:0b}].Count byte 1 run scoreboard players get #1 temp
Best Answer
same source as @rayfloyd's answer