シュルカーボックスの中身を調べる方法

実現したいことはこれです https://discord.com/channels/545926404785569793/587090563074097199/1072855822121570324 1.20.5以降 NBT の仕様が変更され、従来の方法である「 "tag;BlockEntityTag;Items" を利用したアイテムの取り出し」が動かなくなりました。 代替案として以下のコードを書いたのですが、この後このNBTをどのようにアイテムとして取り出すかが不明なため質問させてもらいました。 どちらかというとskriptというよりMinecraftのNBTについての話になってしまいますが回答よろしくお願いします。 書いたコード
function get_shulker_NBT(p: player):
set {_nbt} to nbt of {_p}'s held item
set {_nbt::*} to compound list tag "minecraft:container" of {_nbt}
loop {_nbt::*}:
set {_loopItem} to compound tag "item" of loop-value
broadcast "%{_loopItem}%" (ここが添付画像のNBT)
function get_shulker_NBT(p: player):
set {_nbt} to nbt of {_p}'s held item
set {_nbt::*} to compound list tag "minecraft:container" of {_nbt}
loop {_nbt::*}:
set {_loopItem} to compound tag "item" of loop-value
broadcast "%{_loopItem}%" (ここが添付画像のNBT)
⇩上のコードを使用して得た「テスト」と書かれた石ブロックのNBT https://gyazo.com/6eeacb672bf77c0324cb344b28b74fea
Gyazo
Gyazo
6 Replies
tanoKun
tanoKun2mo ago
PR環境ですか?
GlredMalin
GlredMalinOP2mo ago
はい
tanoKun
tanoKun2mo ago
parsed as Item とかではいけないですかね
GlredMalin
GlredMalinOP2mo ago
試したんですが無理でした
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
これ使えませんか? https://skripthub.net/docs/?id=10691
Skript Hub - Documentation
NBT - Item from NBT (Expression) - SkBee
This expression allows you to grab an item from NBT compounds. This can be useful when wanting to grab items from file nbt, or nbt of an entity or an inventory holding block (like a chest or furnace). It can also be useful for creating your own serializing system. NOTE: Items previously serialized in MC versions 1.20.4 and below, will properly u...
GlredMalin
GlredMalinOP2mo ago
できました! ありがとうございます

Did you find this page helpful?