【我的世界】售賣與回收的商店

本視頻是免窮舉商店指令的教學(xué),非首發(fā)。
-無需每個售賣點窮舉三四個命令塊,只需要
設(shè)置價格和放置商品就可
-對比普通的商店,無需查物品的英文id
-不會吞幣,有顯示和音效
-回收商店是半免舉
一、商店
聊天欄輸入:
/scoreboard objectives add 價格 dummy
/scoreboard objectives add 金幣2 dummy
/scoreboard objectives add 金幣 dummy
指令區(qū):
①execute @a ~~~ scoreboard players operation @s 金幣2 = @s 金幣
②execute @a[scores={價格=1..}] ~~~ scoreboard players operation @s 金幣2 -= @s 價格
③title @a[scores={金幣2=..-1,價格=0..}] title §l§c金幣不足!
④title @a[scores={金幣2=0..,價格=0..}] title §l§a購買成功?
⑤execute @a[scores={金幣2=0..,價格=0..}] ~~~ scoreboard players operation @s 金幣 -= @s 價格
⑥execute @a[scores={金幣2=0..,價格=0..}] ~~~ clone ~~-3~ ~~-3~ ~~2~
⑦execute @a[scores={金幣2=0..,價格=0..}] ~~~ setblock ~~2~ air 0 destroy
⑧kill @e[type=item,name="木桶"]
⑨execute @a[scores={金幣2=0..,價格=0..}] ~~~ title @s subtitle §d @e[type=item,dy=2,c=1] §f已放入您的背包
⑩execute @a[scores={金幣2=0..,價格=0..}] ~~~ playsound random.levelup @s
?scoreboard players reset @a 價格
售賣點處:
scoreboard players set @p[dy=2] 價格 數(shù)字
二、回收
聊天欄:/scoreboard objectives add 回收 dummy
指令區(qū):
①execute @a[scores={回收=1..}] ~~~ title @s title §l§c回收失敗
②execute @a[scores={回收=1..}] ~~~ testforblocks ~~-1~ ~~-1~ ~~-3~
③execute @a[scores={回收=1..}] ~~~ scoreboard players operation @s 金幣 += @s 回收
④execute @a[scores={回收=1..}] ~~~ title @s title §l§a回收成功?
⑤execute @a[scores={回收=1..}] ~~~ playsound random.levelup @s
⑥execute @a[scores={回收=1..}] ~~~ setblock ~~-1~ barrel 1
⑦scoreboard players reset @a 回收
回收點處的指令:
scoreboard players set @p[dy=2] 回收 數(shù)字
?注意命令塊的有無條件和箭頭方向
?給指令區(qū)設(shè)置常加載區(qū)域