448: Counting storage array elements [Minecraft Map Making]
Membership:
Ep448: Saving the number of elements in a storage array to a score, and also saving the number of data keys on an item to a score.
Command help: GalSergey
00:00 Intro
00:20 Setup data and score
01:15 Count array elements
03:30 Count data keys on an item
Version: 1.21
Commands, builds, hacks and ideas for people making their own Minecraft maps.
Check out my collabs on Coppit's channel:
The Discord server I am usually on: https://discord.gg/amU84KykEu
The following commands are prefixed with three letters which represent the settings of the command block. E.g IUN: = Impulse Unconditional Needs_Redstone. These prefixes need to be removed if copying the commands.
Commands used:
Setup:
IUN: data modify storage id:data count set value [0,0,0]
CUA: scoreboard objectives add count dummy
Test Elements:
IUN: execute store result score fake_player count if data storage id:data count[]
CUA: execute if score fake_player count matches 4 run say Match
CUA: execute if score fake_player count matches 2..4 run say Match Range
Test Keys:
IUN: execute store result score fake_player count run data get entity @s SelectedItem
Give item to test key count:
IUN: give @p stone[item_name='"My Stone"']