minecraft scoreboard count multiple block Ids

minecraft scoreboard count multiple block Ids - White Metal High-rise Viewing Deck Building

Is there a way to create a Minecraft scoreboard object that counts all kinds of stone?

Like:

/scoreboard objectives add stonecounter stats.useItem.1
/scoreboard objectives add stonebrickcounter stats.useItem.X
/scoreboard objectives add cobblestonecounter stats.useItem.XX

and then sum all the objectives to one allstonecounter and display that number on the sideboard?

Something like:

/scoreboard objectives setdisplay sideboard (stonecounter+stonebrickcounter+cobblestonecounter)


Best Answer

You can use scoreboard operations to add one score to another.

/scoreboard players operation <affected_target> <affected_objective> <operation> <target> <objective>

Operations available: +=, -=, *=, /=, %=, <, >, ><, =

More information concerning scoreboards can be found here.

Prerequisites:

You will need another objective to hold the value:

/scoreboard objectives add stonetotal dummy

Clock commands:

The following must be run in numerical order on a clock.

  1. Reset all player's "stonetotal" score to 0. Without this, their score will constantly increase.

    /scoreboard players set @a[score_stonetotal_min=1] stonetotal 0
    
  2. Cause all players to run the /scoreboard command, targeting their own scores. They will increment their "stonetotal" score equal to their respective stone scores.

    /execute @a ~ ~ ~ /scoreboard players operation @a[c=1] stonetotal += @a[c=1] stonecounter
    /execute @a ~ ~ ~ /scoreboard players operation @a[c=1] stonetotal += @a[c=1] stonebrickcounter
    /execute @a ~ ~ ~ /scoreboard players operation @a[c=1] stonetotal += @a[c=1] cobblestonecounter
    



Pictures about "minecraft scoreboard count multiple block Ids"

minecraft scoreboard count multiple block Ids - Numbers Wall Decor
minecraft scoreboard count multiple block Ids - Ethnic boy solving mathematical example made of toy numbers
minecraft scoreboard count multiple block Ids - 123 Cutout Decor on Red Surface



How do you add multiple scoreboards in Minecraft?

Add two scores (Addition)...Summary: quick table.+=Addition: Add second's score to that of first=Assign: Set target's score to that of source%=Modulus: Divide first's score by second's score, and use the remainder to set the first score<Min: Set first's score to second's score only if second has the lesser score.5 more rows•May 19, 2020



Minecraft Scoreboard Operation Tutorial [1.16/1.17/1.18/1.19] How to Count Entities




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

Images: Pixabay, Magda Ehlers, Keira Burton, Magda Ehlers