Minecraftで実況者がやっているゲームに出て来る、倒したら斧が壊れ、音の出る斧の作り方を説明します
これはJava 1.19.2で作成しました。
ステップ① 一撃斧を作ろう!
コマンドブロックをインパルスに設定し、以下のコマンドを入力します。そして実行します
/give @p minecraft:stone_axe{display:{Name:"\"一撃斧\""},Damage:181,AttributeModifiers:},{AttributeName:"generic.attack_speed",Amount:100000000,Operation:0,Slot:"mainhand",UUID:}]}
ステップ② スコアボードを作成しよう!
コマンドブロックをインパルスに設定し、以下のコマンドを入力します。そして実行します
scoreboard objectives add hakai_ono minecraft.broken:minecraft.stone_axe
コマンドブロックをインパルスに設定し、以下のコマンドを入力します。そして実行します
scoreboard objectives add kill_ono playerKillCount
ステップ③ 音を出そう!
コマンドブロックをリピート,常時実行に設定し、以下のコマンドを入力します。
scoreboard players set @a hakai_ono 0
コマンドブロックをリピート,常時実行に設定し、以下のコマンドを入力します。
scoreboard players set @a kill_ono 0
コマンドブロックをリピート,常時実行に設定し、以下のコマンドを入力します。
execute at @a at @a run playsound minecraft:item.totem.use master @a ~ ~ ~ 5 0.5
以上で完成です!