How to move an item from a chest to the player inventory using tags - Command Blocks Advanced Guide

How to move an item from a chest to the player inventory using tags - Command Blocks Advanced Guide

Subscribers:
9,940
Published on ● Video Link: https://www.youtube.com/watch?v=-jiGxy86aA0



Minecraft
Game:
Minecraft (2011)
Category:
Guide
Duration: 12:02
4,836 views
69


#tag #Minecraft #command
Players NBT data cannot be modified, but we found a perfect workaround targeting the item the moment it moves from a chest to the player and still can be called an entity.

We advance on the previous guide: https://www.youtube.com/watch?v=I8t7w_xIH-o
So if you have no idea what's happening, please watch that one first, it's packed with vital lessons.



Special thanks to reddit user https://www.reddit.com/user/amazing56789 for giving some tips on this guide.


Difficulty: 4 stars

Lessons learned in this tutorial:
- How to use a tag to identify an item
- How to execute a command at a player location
- How to summon an entity



Commands used in this guide: Brackets are not allowed in Video description: so change ^ to a greater than bracket

Impulse Command Block::
- execute if score @p gold ^= storeManager shopItem001Gold

Conditional Chain Command Blocks:
- execute if score storeManager shopItem001Stock ^= storeManager shopItem001Batch run scoreboard players operation @p gold -= storeManager shopItem001Gold
- execute store result block 196 63 -300 Items[{Slot:0b}].Count byte 1 run scoreboard players get storeManager shopItem001Batch
- scoreboard players operation storeManager shopItem001Stock -= storeManager shopItem001Batch
- execute at @p run summon minecraft:item ~ ~ ~ {Tags:["shopItem001"],Item:{id:"minecraft:stone",Count:1b}}
- data modify entity @e[type=minecraft:item, tag=shopItem001, limit=1] Item set from block 196 63 -300 Items[{ Slot:0b }]

Unconditional chain command blocks:
- setblock 194 62 -299 minecraft:birch_planks
- 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 How it used to work
2:22 Checking if player has enough gold
3:05 Checking if there is enough stock and subtract gold
4:14 Adding the batch size to the item quantity

6:48 Subtracting the batch size from the stock
7:48 Summon item with tag at the players coords
9:53 Change the tagged item to the sold item and quantity
11:02 Test & Outro

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

Subscribe! Subscribing is free and helps us grow

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

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







Tags:
Minecraft
Command
Block
Commandblock
tag
summon
item
player
help
guide
tutorial
how to
faq



Other Statistics

Minecraft Statistics For Forgotten Games

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