How to use the /data command to automate your store - Minecraft Command Blocks Guide

How to use the /data command to automate your store - Minecraft Command Blocks Guide

Subscribers:
6,890
Published on ● Video Link: https://www.youtube.com/watch?v=I8t7w_xIH-o



Minecraft
Game:
Minecraft (2011)
Category:
Guide
Duration: 33:37
2,739 views
68


#Minecraft #data #commandblocks
Learn how to use /data modify, /data get and /data merge to change your shop items, price, stock and batch size with just 1 button and the item in your hand.

Data is the most powerful command in minecraft and allows you to manipulate data of items and blocks and even read into player data and use those values. Together with execute score
This masterclass is the first 5 star difficulty roll out in the command blocks series.

Difficulty: 5 stars

In this tutorial you learn:
- How to use the data command
- How to manipulate data in blocks and entities
- How to use the scoreboard
- How to merge and modify data between blocks
- How to use the execute store command
- How to target nbt data in directed commands

Commands used:
Building the scoreboard:
/scoreboard objectives add shopItem001Stock dummy
/scoreboard objectives add shopItem001Hand dummy
/scoreboard objectives add shopItem001Batch dummy
/scoreboard objectives add shopItem001Gold dummy
/scoreboard players set shopManager shopItem001Gold 1
/scoreboard objectives add gold dummy {"text":"Gold Coins","color":"gold"}

Setting the storemanager:
- data modify block 196 63 -300 Items append from entity @p SelectedItem
- data modify block 196 63 -300 Items[{Slot:0b}].Count set value 1
- execute as @p store result score storeManager shopItem001Hand run data get entity @p SelectedItem.Count
- data modify block 196 63 -301 Items[] set from block 196 63 -300 Items[]
- execute as @p store result score storeManager shopItem001Batch run data get entity @p SelectedItem.Count
- scoreboard players set storeManager shopItem001Stock 0
- data modify entity @e[type=minecraft:item_frame, limit=1, nbt={TileX:192,TileY:64,TileZ:-297}] Item merge from entity @p SelectedItem
- scoreboard players operation storeManager shopItem001Stock += storeManager shopItem001Hand
- CHECK BELOW FOR LAST COMMAND BLOCK (Data merge sign)

**Angled brackets aren't allowed in Youtube description so read them as ^= equals more than or equal for the next 2 commands.

Activating the Buy Sign:
- execute unless score @p gold ^= storeManager shopItem001Gold run tellraw @p {"text":"You don't have enough gold!","color":"red"}
Subscribe! Subscribing is free and helps us grow
- execute if score storeManager shopItem001Stock ^= storeManager shopItem001Batch run scoreboard players operation @p gold -= storeManager shopItem001Gold
- setblock 191 65 -297 minecraft:barrel
- data modify block 191 65 -297 Items[] set from block 196 63 -300 Items[]
- execute store result block 191 65 -297 Items[{Slot:0b}].Count byte 1 run scoreboard players get storeManager shopItem001Batch
- setblock 191 65 -297 minecraft:air destroy
- scoreboard players operation storeManager shopItem001Stock -= storeManager shopItem001Batch
- setblock 194 62 -299 minecraft:birch_planks
- kill @e[type=minecraft:item,nbt={Item:{id:"minecraft:barrel"}}]
- CHECK BELOW FOR LAST COMMAND BLOCK (Data merge sign)

Data merge the sign:
data merge block 192 65 -297 {"Text1":'{"text":"[BUY]","color":"aqua","clickEvent":{"action":"run_command","value":"setblock 194 62 -299 minecraft:redstone_block"}}',"Text2":'{"text":"Today\'s Special","color":"gold"}',"Text3":'[{"score":{"name":"storeManager","objective":"shopItem001Gold"},"color":"yellow"}, {"text":" : ","color":"white"}, {"score":{"name":"storeManager","objective":"shopItem001Batch"},"color":"yellow"}]',"Text4":'[{"text":"In stock: ","color":"white"},{"score":{"name":"storeManager","objective":"shopItem001Stock"},"color":"gold"}]'}

0:00 Intro
1:20 Set the scoreboard
3:48 Seller step 1: Remember which item to sell
10:09 Seller step 2: Store how many we want to sell
12:04 Seller step 3: Check if we have a new or same item in hand
12:43 Seller step 4: Reset the stock with new items
13:25 Seller step 5: Put hand item in item frame
15:23 Seller step 6: Add quantity to stock
16:45 Seller step 7: Create interactable sign
22:22 Seller step 8: Substract stock from storemanager
24:50 Buyer step 1: Check if we have enough gold
25:48 Buyer step 2: Check if the store has enough stock
27:12 Buyer step 3: Create a container for the bought items
27:49 Buyer step 4: Copy items from seller to buyer
30:09 Buyer step 5: Break the container
30:20 Buyer step 6: Extract items from stock
32:29 Buyer step 7: Update the sign
32:43 Outro

Check out the entire playlist with command blocks guides here:
https://www.youtube.com/playlist?list=PLHd3EltAylPSbwBEpmOnOgI--sXhiBtrG

Join our discord:
- https://discord.gg/CDtGd7x

Join this channel to get access to perks:
- https://www.youtube.com/channel/UCxnPA3lQx8rBUzEpdIgzOaA/join







Tags:
data merge
data modify
data get
how to use data command
minecraft
command blocks
data remove
data
shop
automate



Other Statistics

Minecraft Statistics For Forgotten Games

Forgotten Games presently has 156,090 views for Minecraft across 40 videos, with His channel uploaded over 1 day worth of Minecraft videos. This makes up 5.18% of the content that Forgotten Games has uploaded to YouTube.