LoginSignup
0
0

NBTから見る逆引きcomponent【MinecraftJE1.20.5】

Last updated at Posted at 2024-05-21

はじめに

1.20.4 → 1.20.5のアップデートにおけるアイテムの変更について

  • どのアイテムNBTがどのcomponentに変わったのか
  • 出来なくなった表現はどのようなものか

の2点に焦点を当て、NBT側を見出しとしてまとめます。

対応例はitem構文(id[component=value])状ではなく
/data get時に観測できるかたちで示します。
例 : {tag:{}}{components:{}}

この記事は元々移行作業のためにゲーム内で検証しながら書いたものですが、
どこまで行っても二次情報なので内容を鵜呑みにはせず、ご自身でも検証しながら
参考程度に読んでいただければと思います

全体

  • アイテムidごとにcomponentのデフォルト値が設定されており、デフォルト値と等しい値をcomponentに設定した場合はデータ上から記述が削除されるようになった
    • 1.20.4
      {id:"minecraft:iron_sword",Count:1b,tag:{Damage:0}}
      
      1.20.5
      {id:"minecraft:iron_sword",count:1}
      

  • ! + <component>のような記述のcomponentを追加すると、アイテムにデフォルトで設定されているcomponentを無効化できる
    • 例 : 食べられないリンゴ
      {id:"minecraft:apple",count:1,components:{"!minecraft:food":{}}}
      

各NBT対応リスト

任意に追加したタグ

minecraft:custom_data=<compound>

対応例
  1. 1.20.4
    {tag:{_cp58:{metadata:2}}}
    
    1.20.5
    {components:{"minecraft:custom_data":{_cp58:{metadata:2}}}}
    

AttributeModifiers

minecraft:attribute_modifiers={modifiers:[]}

詳細
  • AttributeName
    type: <string> (attribute id)

  • Name
    name: <string> (任意の文字列)

  • Amount
    amount: <double>

  • Slot
    slot: <string> (↓から選択)

    • 値の種類
    対象
    any 全スロット(デフォルト)
    mainhand 利き手
    offhand オフハンド
    head 頭装備
    chest チェストプレート
    legs レギンス
    feet ブーツ
    以下新規追加
    hand offhandmainhand両方
    armor 防具すべて(head,chest,legs,feetのどれでも発動)
    body 馬鎧やオオカミの鎧などを付けるスロット
  • Operation
    operation: <string> (↓から選択)

    • 値の変更
    ~1.20.4 1.20.5~
    0 "add_value"
    1 "add_multiplied_base"
    2 "add_multiplied_total"
  • UUID
    uuid: <int_array>

対応例
  1. 1.20.4
    {tag:{AttributeModifiers:[{AttributeName:"minecraft:generic.max_health",Name:"_cp58:",Amount:20.0d,Slot:"head",Operation:0,UUID:[I;1,0,1,0]}]}}
    
    1.20.5
    {components:{"minecraft:attribute_modifiers":{modifiers:[{type:"minecraft:generic.max_health",name:"_cp58:",amount:20.0d,slot:"head",operation:"add_value",uuid:[I;1,0,1,0]}]}}}
    

author

minecraft:written_book_contentcomponentに統合された

BlockEntityTag

minecraft:block_entity_data=<compound>

BlockEntityTagのうち、他のcomponentとして独立していないNBTたちを格納するためのcomponentとなっている

中にidの記述が必須だが、string型であれば空っぽでも何でも許容される

対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{Command:"function _cp58:",auto:1b}}}
    
    1.20.5
    {components:{"minecraft:block_entity_data":{id:"minecraft:command_block",Command:"function _cp58:",auto:1b}}}
    

BlockEntity.Base

minecraft:base_color=<string>

旗を付けたshieldの 旗の地の色を保存するタグ

詳細
~1.20.4 1.20.5~
0 "white"
1 "orange"
2 "magenta"
3 "light_blue"
4 "yellow"
5 "lime"
6 "pink"
7 "gray"
8 "light_gra"
9 "cyan"
10 "purple"
11 "blue"
12 "brown"
13 "green"
14 "red"
15 "black"
対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{Base:0}}}
    
    1.20.5
    {components:{"minecraft:base_color":"white"}}
    

BlockEntityTag.Bees

minecraft:bees=[]

minecraft:containerItemsの関係とは異なり、こちらはbeesNBTがそのままminecraft:beescomponentに格納されている
というよりブロック側のNBT名がこのcomponentに合わせて変更されている

詳細
  • EntityData
    entity_data: <compound>

  • MinOccupationTicks
    min_ticks_in_hive: <int>

  • TicksInHive
    ticks_in_hive: <int>

対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{Bees:[{EntityData:{id:"minecraft:bee"},MinOccupationTicks:600,TicksInHive:0}]}}}
    
    1.20.5
    {components:{"minecraft:bees":[{entity_data:{id:"minecraft:bee"},min_ticks_in_hive:600,ticks_in_hive:0}]}}
    

BlockEntityTag.Items

minecraft:container=[{slot:<int>,item:<item stack>}]

ブロックのItemsNBTとデータ構造が異なるので注意

詳細
  • id
    item.id: <string> (アイテムid)

  • Count
    item.count: <int>

  • Slot
    slot: <int>

対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{Items:[{id:"minecraft:iron_sword",Count:1b,Slot:3b,tag:{Unbreakable:1b}}]}}}
    
    1.20.5
    {components:{"minecraft:container":[{slot:3,item:{id:"minecraft:iron_sword",count:1,components:{"minecraft:unbreakable":{}}}}]}}
    

BlockEntityTag.Lock

minecraft:lock=<string>

対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{Lock:"VaultKey"}}}
    
    1.20.5
    {components:{"minecraft:lock":'VaultKey'}}
    

BlockEntityTag.LootTable

minecraft:container_loot={loot_table:<loot_table id>}

詳細
  • LootTableSeed
    seed: <int> (任意)
対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{LootTable:"minecraft:chests/buried_treasure",LootTableSeed:58}}}
    
    1.20.5
    {components:{"minecraft:container_loot":{loot_table:'minecraft:chests/buried_treasure',seed:58}}}
    

BlockEntityTag.LootTableSeed

minecraft:container_lootcomponentに統合されseedとなった

BlockEntityTag.note_block_sound

minecraft:note_block_sound=<string>

1.20でplayer_headに追加された、そのplayer_headを上に乗せて音ブロックを鳴らしたときに再生されるサウンドを指定するタグ

対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{note_block_sound:"minecraft:entity.experience_orb.pickup"}}}
    
    1.20.5
    {components:{"minecraft:note_block_sound":"minecraft:entity.experience_orb.pickup"}}
    

BlockEntityTag.Patterns

minecraft:banner_patterns=[]

ブロック状態でのNBT構成も変更されている

詳細
  • Patterns[].Pattern
    patterns[].pattern

  • Patterns[].Color
    patterns[].color

詳細
  • Pattern
    pattern: <string> (namespace+idのかたちに)

    詳細
    ~1.20.4 1.20.5~
    "b" "minecraft:base"
    "bs" "minecraft:stripe_bottom"
    "ts" "minecraft:stripe_top"
    "ls" "minecraft:stripe_left"
    "rs" "minecraft:stripe_right"
    "cs" "minecraft:stripe_center"
    "ms" "minecraft:stripe_middle"
    "drs" "minecraft:stripe_downright"
    "dls" "minecraft:stripe_downleft"
    "ss" "minecraft:small_stripes"
    "cr" "minecraft:cross"
    "sc" "minecraft:straight_cross"
    "ld" "minecraft:diagonal_left"
    "rud" "minecraft:diagonal_up_right"
    "lud" "minecraft:diagonal_up_left"
    "rd" "minecraft:diagonal_right"
    "vh" "minecraft:half_vertical"
    "vhr" "minecraft:half_vertical_right"
    "hh" "minecraft:half_horizontal"
    "hhb" "minecraft:half_horizontal_bottom"
    "bl" "minecraft:square_bottom_left"
    "br" "minecraft:square_bottom_right"
    "tl" "minecraft:square_top_left"
    "tr" "minecraft:square_top_right"
    "bt" "minecraft:triangle_bottom"
    "tt" "minecraft:triangle_top"
    "bts" "minecraft:triangles_bottom"
    "tts" "minecraft:triangles_top"
    "mc" "minecraft:circle"
    "mr" "minecraft:rhombus"
    "bo" "minecraft:border"
    "cbo" "minecraft:curly_border"
    "bri" "minecraft:bricks"
    "gra" "minecraft:gradient"
    "gru" "minecraft:gradient_up"
    "cre" "minecraft:creeper"
    "sku" "minecraft:skull"
    "flo" "minecraft:flower"
    "moj" "minecraft:mojang"
    "glb" "minecraft:globe"
    "pig" "minecraft:piglin"
    "minecraft:flow"
    "minecraft:guster"
  • Color
    color: <string>

    詳細
    ~1.20.4 1.20.5~
    0 "white"
    1 "orange"
    2 "magenta"
    3 "light_blue"
    4 "yellow"
    5 "lime"
    6 "pink"
    7 "gray"
    8 "light_gra"
    9 "cyan"
    10 "purple"
    11 "blue"
    12 "brown"
    13 "green"
    14 "red"
    15 "black"
対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{Patterns:[{Pattern:"mc",Color:14}]}}}
    
    1.20.5
    {components:{"minecraft:banner_patterns":[{pattern:"minecraft:circle",color:"red"}]}}
    

BlockEntityTag.sherds

minecraft:pot_decorations=[]
(飾り壺の作成に使った欠片を保存するcomponent)

対応例
  1. 1.20.4
    {tag:{BlockEntityTag:{sherds:["minecraft:brick","minecraft:brick","minecraft:brick","minecraft:archer_pottery_sherd"]}}}
    
    1.20.5
    {components:{"minecraft:pot_decorations":["minecraft:brick","minecraft:brick","minecraft:brick","minecraft:archer_pottery_sherd"]}}
    

BlockStateTag

minecraft:block_state={}

数値のプロパティも全て文字列として表記しなければならなくなった

対応例
  1. 1.20.4
    {tag:{BlockStateTag:{moisture:7}}}
    
    1.20.5
    {components:{"minecraft:block_state":{moisture:"7"}}}
    

BucketVariantTag

minecraft:bucket_entity_data={BucketVariantTag:<int>}

元々エンティティ入りバケツは、入れたエンティティの一部のNBTを抜粋して保存していた
その保存先がtag直下だった(!?)ため、めちゃめちゃ雑に保存されてたNBTたちがこのcomponentにまとめられたかたちになる

詳細 以下エンティティNBTのうちバケツに保存されるNBTリスト
エンティティNBT 保存先
CustomName "minecraft:custom_name"(=アイテムの表示名)
Health "minecraft:bucket_entity_data".Health
NoAI "minecraft:bucket_entity_data".NoAI
Silent "minecraft:bucket_entity_data".Silent
Invulnerable "minecraft:bucket_entity_data".Invulnerable
NoGravity "minecraft:bucket_entity_data".NoGravity
Glowing "minecraft:bucket_entity_data".Glowing
Age(axolotl) "minecraft:bucket_entity_data".Age
memories."minecraft:has_hunting_cooldown".ttl(axolotl) "minecraft:bucket_entity_data".HuntingCooldown
Variant(axolotl) "minecraft:bucket_entity_data".Variant
Variant(tropical_fish) "minecraft:bucket_entity_data".BucketVariantTag
$\hspace{48em}$
対応例
  1. 1.20.4
    {tag:{DebugProperty:{"minecraft:chest":"type"}}}
    
    1.20.5
    {components:{"minecraft:debug_stick_state":{"minecraft:chest":"type"}}}
    

CanDestroy

minecraft:can_break={blocks:[]}

新記法{predicates:[<block_predicate>]}について <block_predicate>は、location predicateにおけるblockの記述とほぼ同じ書き方をする
例 : {blocks:["minecraft:campfire","minecraft:soul_campfire"],nbt:"{Items:[]}",state:{lit:"true"}}
見づらいので成形↓
{
    blocks: [
        "minecraft:campfire",
        "minecraft:soul_campfire"
    ],
    nbt: "{Items:[]}",
    state: {
        lit: "true"
    }
}
対応例
  1. 1.20.4
    {tag:{CanDestroy:["#minecraft:fences"]}}
    
    1.20.5
    {components:{"minecraft:can_break":{blocks:["#minecraft:fences"]}}}
    
    #記述したい要素が一つなら`[]`は省略可能
    {components:{"minecraft:can_break":{blocks:"#minecraft:fences"}}}
    
    #(最も冗長な書き方)
    {components:{"minecraft:can_break":{predicates:[{blocks:["#minecraft:fences"]}]}}}
    

CanPlaceOn

minecraft:can_place_on={blocks:[]}

(minecraft:can_breakcomponentと同じ書き方)

対応例
  1. 1.20.4
    {tag:{CanPlaceOn:["#minecraft:fences"]}}
    
    1.20.5
    {components:{"minecraft:can_place_on":{blocks:["#minecraft:fences"]}}}
    
    #記述したい要素が一つなら`[]`は省略可能
    {components:{"minecraft:can_place_on":{blocks:"#minecraft:fences"}}}
    
    #(最も冗長な書き方)
    {components:{"minecraft:can_place_on":{predicates:[{blocks:["#minecraft:fences"]}]}}}
    

Charged

minecraft:charged_projectilescomponentに統合された

これにより1.20.4以前できていた
"矢装填済みの見た目だが使っても何も発射されない"
という状態のクロスボウが再現できなくなった

かと思われたが... 24w18aでエンチャントがdata-driven化され、発射物が召喚された瞬間にfunctionを実行できるようになったため、1.21では同様の挙動を再現できるかと思われる
みんな1.20.5対応して1.21を待とう!

ChargedProjectiles

minecraft:charged_projectiles=[<item stack>]

対応例
  1. 1.20.4
    {tag:{Charged:1b,ChargedProjectiles:[{id:"minecraft:arrow",Count:1b}]}}
    
    1.20.5
    {components:{"minecraft:charged_projectiles":[{id:"minecraft:arrow",count:1}]}}
    

custom_potion_effects

minecraft:potion_contents={custom_effects:[]}
minecraft:potion_contentscomponentに統合されcustom_effectsとなった

area_effect_cloudのNBT構成もこのcomponentと同じかたちに変更されている

詳細
  • Potion
    potion_contents.potion

  • effects
    potion_contents.custom_effects

  • Color
    potion_contents.custom_color

対応例
  1. 1.20.4
    {tag:{custom_potion_effects:[{id:"minecraft:resistance",amplifier:4,duration:-1,show_particles:false}],CustomPotionColor:16777215}}
    
    1.20.5
    {components:{"minecraft:potion_contents":{custom_effects:[{id:"minecraft:resistance",amplifier:4,duration:-1,show_particles:false}],custom_color:16777215}}}
    

CustomPotionColor

minecraft:potion_contents={custom_color:<int>}
minecraft:potion_contentscomponentに統合されcustom_colorとなった

CustomModelData

minecraft:custom_model_data=<int>

対応例
  1. 1.20.4
    {tag:{CustomModelData:128}}
    
    1.20.5
    {components:{"minecraft:custom_model_data":128}}
    

Damage

minecraft:damage=<int>(0以上)

対応例
  1. 1.20.4
    {tag:{Damage:2}}
    
    1.20.5
    {components:{"minecraft:damage":2}}
    

DebugProperty

minecraft:debug_stick_state=<compound>

対応例
  1. 1.20.4
    {tag:{DebugProperty:{"minecraft:chest":"type"}}}
    
    1.20.5
    {components:{"minecraft:debug_stick_state":{"minecraft:chest":"type"}}}
    

Decorations

minecraft:map_decorations={<string>:{}}

詳細
  • id
    ↳ 任意の文字列をkeyとして下記のタグを含有するcompoundを設定するようになった

  • type
    type: <string> (int型から変更)

    詳細
    ~1.20.4 1.20.5~ 画像
    0 "player"
    1 "frame"
    2 "red_marker"
    3 "blue_marker"
    4 "target_x"
    5 "target_point"
    6 "player_off_map"
    7 "player_off_limits"
    8 "mansion"
    9 "monument"
    10 "banner_white"
    11 "banner_orange"
    12 "banner_magenta"
    13 "banner_light_blue"
    14 "banner_yellow"
    15 "banner_lime"
    16 "banner_pink"
    17 "banner_gray"
    18 "banner_light_gray"
    19 "banner_cyan"
    20 "banner_purple"
    21 "banner_blue"
    22 "banner_brown"
    23 "banner_green"
    24 "banner_red"
    25 "banner_black"
    26 "red_x"
    27 "village_desert"
    28 "village_plains"
    29 "village_savanna"
    30 "village_snowy"
    31 "village_taiga"
    32 "jungle_temple"
    33 "swamp_hut"
    "trial_chambers"
  • x
    x: <double> (絶対座標)

  • z
    z: <double> (絶対座標)

  • rot
    rotation: <float>(double型から変更)
    $\hspace{0.6em}$時計回りに北から、360.0で一周

対応例
  1. 1.20.4
    {tag:{Decorations:[{id:"_cp58:0",type:26,x:0.0d,z:0.0d,rot:180.0d}]}}
    
    1.20.5
    {components:{"minecraft:map_decorations":{"_cp58:0":{type:"red_x",x:0.0d,z:0.0d,rotation:180.0f}}}}
    

display.Name

minecraft:custom_name=<chat_component>

対応例
  1. 1.20.4
    {tag:{display:{Name:'{"text":"名前"}'}}}
    
    1.20.5
    {components:{"minecraft:custom_name":'{"text":"名前"}'}}
    

display.Lore

minecraft:lore=[<chat_component>]

対応例
  1. 1.20.4
    {tag:{display:{Lore:['{"text":"1行目"}','{"text":"2行目"}']}}}
    
    1.20.5
    {components:{"minecraft:lore":['{"text":"1行目"}','{"text":"2行目"}']}}
    

display.color

minecraft:dyed_color={rgb:<int>}

対応例
  1. 1.20.4
    {tag:{display:{color:16777215}}}
    
    1.20.5
    {components:{"minecraft:dyed_color":{rgb:16777215}}}
    

display.MapColor

minecraft:map_color=<int>

対応例
  1. 1.20.4
    {tag:{display:{MapColor:16711680}}}
    
    1.20.5
    {components:{"minecraft:map_color":16711680}}
    

effects

minecraft:suspicious_stew_effects=[]

公式記事ではminecraft:suspicious_stewとされているが恐らく間違いで、
ゲーム内ではminecraft:suspicious_stew_effectsが確認された

詳細 (中身のエフェクト指定部分に変更は無い)
  • id
    id: <string> (effect id)

  • duration
    duration: <int> (tick単位,指定しない場合160扱い)

対応例
  1. 1.20.4
    {tag:{effects:[{id:"minecraft:saturation",duration:7}]}}
    
    1.20.5
    {components:{"minecraft:suspicious_stew_effects":[{id:"minecraft:saturation",duration:7}]}}
    

Enchantments

minecraft:enchantments={levels:{<id>:<int>}}

アイテムツールチップ上のエンチャント表示順が
"エンチャントを追加した順" から
"新規追加のenchantment tag#minecraft:tooltip_order内の記述順"
に変更されている

対応例
  1. 1.20.4
    {tag:{Enchantments:[{id:"minecraft:protection",lvl:1s}]}}
    
    1.20.5
    {components:{"minecraft:enchantments":{levels:{'minecraft:protection':1}}}}
    

EntityTag

minecraft:entity_data=<compound>

対応例
  1. 1.20.4
    {tag:{EntityTag:{id:"minecraft:husk",NoAI:1b,Silent:1b,Tags:["_cp58"]}}}
    
    1.20.5
    {components:{"minecraft:entity_data":{id:"minecraft:husk",NoAI:1b,Silent:1b,Tags:["_cp58"]}}}
    

Explosion

minecraft:firework_explosion={}

詳細
  • Type
    shape: <string>

    詳細
    ~1.20.4 1.20.5~
    0b small_ball
    1b large_ball
    2b star
    3b creeper
    4b burst
  • Colors
    colors: <int_array>

  • FadeColors
    fade_colors: <int_array>

  • Trail
    has_trail: <byte> (0b or 1b, 指定しない場合0b扱い)

  • Flicker
    has_twinkle: <byte> (0b or 1b, 指定しない場合0b扱い)

対応例
  1. 1.20.4
    {tag:{Explosion:{Type:0b,Colors:[I;11743532],FadeColors:[I;2437522],Trail:1b,Flicker:1b}}}
    
    1.20.5
    {components:{"minecraft:firework_explosion":{shape:"small_ball",colors:[I;11743532],fade_colors:[I;2437522],has_trail:1b,has_twinkle:1b}}}
    

Fireworks

minecraft:fireworks={explosions:[],flight_duration:<byte>}

詳細
対応例
  1. 1.20.4
    {tag:{Fireworks:{Explosions:[{Type:0b,Colors:[I;11743532],FadeColors:[I;2437522],Trail:1b,Flicker:1b}],Flight:3b}}}
    
    1.20.5
    {components:{"minecraft:fireworks":{explosions:[{shape:"small_ball",colors:[I;11743532],fade_colors:[I;2437522],has_trail:1b,has_twinkle:1b}],flight_duration:3b}}}
    

generation

minecraft:written_book_contentcomponentに統合された

HideFlags

minecraft:<component>={show_in_tooltip:0b}

HideFlagsは根本的に書き方が変わったNBTの一つで、
どのタグを非表示にしているかわかりやすくなった半面、
再現不能になった表現も多い

詳細
対象NBT 1.20.5~
1 Enchantments "minecraft:enchantments":{show_in_tooltip:0b}
2 AttributeModifiers "minecraft:attribute_modifiers":{show_in_tooltip:0b}
4 Unbreakable "minecraft:unbreakable":{show_in_tooltip:0b}
8 CanDestroy "minecraft:can_break":{show_in_tooltip:0b}
16 CanPlaceOn "minecraft:can_place_on":{show_in_tooltip:0b}
32 StoredEnchantments "minecraft:stored_enchantments":{show_in_tooltip:0b}
32 その他 "minecraft:hide_additional_tooltip":{}
64 display.color "minecraft:dyed_color":{show_in_tooltip:0b}
128 Trim "minecraft:trim":{show_in_tooltip:0b}
$\hspace{38em}$

基本的には対象のcomponent内に新規実装されているshow_in_tooltipタグを0bにすればtooltipへの表示を消すことができる

ただしcomponentは記述必須のタグが多いため、HideFlagsのようにshow_in_tooltipのみを記述することはほとんどの場合できない

弊害の例と対処法
  • attribute_modifierscomponent を非表示にしたいとする
    もちろん自分で新たに付与したattributeは問題なく非表示にできるが、剣などにデフォルトで付与されているattribute_modifiersの表示を消そうすると手間がかかる。

    しかしattribute_modifierscomponentにはmodifiers:[]の記述が必須。
    デフォルトのattributeを消さずにshow_in_tooltip:0bだけ付与することはできず、
    デフォルトの値を再現しながらmodifiersも一緒に記述するしかない。

    ここで使えるのが新登場のloot function(item_modifierに書くやつ)、toggle_tooltips

    1. "toggle_tooltips" loot function
      {
          "function": "minecraft:toggle_tooltips",
          "toggles": {
              "attribute_modifiers": false
          }
      }
      

    これで素のdiamond_sword/item modifyすると...

    1. {id:"minecraft:diamond_sword",count:1}
      

    これが

    1. {
          id:"minecraft:diamond_sword",count:1,
          components:{
              "minecraft:attribute_modifiers":{
                  show_in_tooltip:0b,
                  modifiers:[
                      {
                          name:"Weapon modifier",
                          amount:6.0d,
                          slot:"mainhand",
                          type:"minecraft:generic.attack_damage",
                          uuid:[I; -885041709,1683771192,-1533567981,-1556236849],
                          operation:"add_value"
                      },
                      {
                          name:"Weapon modifier",
                          amount:-2.4000000953674316d,
                          slot:"mainhand",
                          type:"minecraft:generic.attack_speed",
                          uuid:[I;-98353636,1098926181,-1340359474,-1752847197],
                          operation:"add_value"
                      }
                  ]
              }
          }
      }
      

    こうなる(見やすいよう成形済み)。
    つまりitems.jsonに定義されているアイテムのcomponentのデフォルト値をコピーしてきて、show_in_tooltip:0bを追記してくれているという...
    信じられないような実装だが、これしか書き方が無いので仕方ない。
    自動でデフォルトの値をコピーしてきてくれてる分マシとも言えるかもしれない。

    残念ながら手動で値を再現して書く以外/giveだけで完結させる方法は存在しないが、
    item_modifierをインラインで書けるようになったので

    1. /item modify @s weapon.* {function:"toggle_tooltips",toggles:{attribute_modifiers:false}}
      

    このような書き方ができる。
    これを実行すれば手に持っているアイテムのattribute_modifiersを非表示にできる。
    中身は冗長になるが、手動で再現するよりは簡単なのでこれを対処法として挙げる。
    (24w20a現在、防具はなぜかデフォルトでmodifiersが空なので{show_in_tooltip:0b,modifiers:[]}でデフォルト値を保存したまま非表示にできる)

対応例
  1. 1.20.4
    {tag:{HideFlags:1,Enchantments:[{id:"minecraft:protection",lvl:4s}]}}
    
    1.20.5
    {components:{"minecraft:enchantments":{show_in_tooltip:0b,levels:{"minecraft:protection":4}}}}
    

  1. 1.20.4
    {id:"minecraft:iron_sword",Count:1b,tag:{HideFlags:2}}
    
    1.20.5
    {id:"minecraft:iron_sword",count:1,components:{"minecraft:attribute_modifiers":{show_in_tooltip:0b,modifiers:[{name:"Weapon modifier",amount:5.0d,slot:"mainhand",type:"minecraft:generic.attack_damage",uuid:[I;-885041709,1683771192,-1533567981,-1556236849],operation:"add_value"},{name:"Weapon modifier",amount:-2.4000000953674316d,slot:"mainhand",type:"minecraft:generic.attack_speed",uuid:[I;-98353636,1098926181,-1340359474,-1752847197],operation:"add_value"}]}}}
    

  1. 1.20.4
    {tag:{HideFlags:4,Unbreakable:1b}}
    
    1.20.5
    {components:{"minecraft:unbreakable":{show_in_tooltip:0b}}}
    

  1. 1.20.4
    {tag:{HideFlags:32,StoredEnchantments:[{id:"minecraft:mending",lvl:1s}]}}
    
    1.20.5
    {components:{"minecraft:stored_enchantments":{show_in_tooltip:0b,levels:{"minecraft:mending":1}}}}
    

  1. 1.20.4
    {tag:{HideFlags:32,CustomPotionEffects:[{id:"minecraft:resistance",amplifier:4b,duration:200}]}}
    
    1.20.5
    {components:{"hide_additional_tooltip":{},"minecraft:potion_contents":{custom_effects:[{id:"minecraft:resistance",amplifier:4b,duration:200}]}}}
    

  • 番外編

    1.20.4
    {tag:{HideFlags:1,Enchantments:[{}]}}
    
    #テクスチャのテカテカオーバーレイだけ付けるやつ
    
    1.20.5
    {components:{"minecraft:enchantment_glint_override":1b}}
    
    #エンチャントの記述変更で"minecraft:enchantments"componentではできなくなったが、
    #新規追加の"minecraft:enchantment_glint_override"componentで同様の表現が可能
    

instrument

minecraft:instrument=<string>

対応例
  1. 1.20.4
    {tag:{instrument:"minecraft:yearn_goat_horn"}}
    
    1.20.5
    {components:{"minecraft:instrument":"minecraft:yearn_goat_horn"}}
    

Items

minecraft:bundle_contents=[<item stack>]

tag直下のItemsはバンドル(minecraft:bundle)の中身を指すNBTであり、
chestなどcontainer系ブロックの中身のItemsBlockEntityTag.Itemsを参照

対応例
  1. 1.20.4
    {tag:{Items:[{id:"minecraft:axolotl_bucket",Count:1b}]}}
    
    1.20.5
    {components:{"minecraft:bundle_contents":[{id:"minecraft:axolotl_bucket",count:1}]}}
    

LodestoneDimension

minecraft:lodestone_trackercomponentに統合された

LodestonePos

minecraft:lodestone_tracker={target:{pos:[I;<int>,<int>,<int>],dimension:<string>},tracked:<boolean>}

詳細
  • LodestonePos
    target.pos: <int_array>

  • LodestoneDimension
    target.dimension: <string> (dimension id)

  • LodestoneTracked
    tracked: <byte> (0b or 1b, 指定しない場合1b扱い)

対応例
  1. 1.20.4
    {tag:{LodestonePos:{X:0,Y:255,Z:65535},LodestoneDimension:"minecraft:the_nether",LodestoneTracked:1b}}
    
    1.20.5
    {components:{"minecraft:lodestone_tracker":{target:{pos:[I;0,255,65535],dimension:"minecraft:the_nether"},tracked:1b}}}
    
    #tracked:1bは内部的には省略され、↓のかたちになる
    {components:{"minecraft:lodestone_tracker":{target:{pos:[I;0,255,65535],dimension:"minecraft:the_nether"}}}}
    

LodestoneTracked

minecraft:lodestone_trackercomponentに統合された

map

minecraft:map_id=<int>

対応例
  1. 1.20.4
    {tag:{map:1}}
    
    1.20.5
    {components:{"minecraft:map_id":1}}
    

pages

本と羽根ペン(writable_book)

minecraft:writable_book_content={pages:[<filtered strings>]}

pagesの中身が filtered string と呼ばれるデータ構造に変更されている

  • filtered string {raw:'<string>',filtered:'<string>'} rawは必須だがfilteredは任意で設定するタグとなっている

    基本的にはrawに設定された文字列が表示されるが、MinecraftアカウントJAVA REALMS PROFANITY FILTERという設定が有効になっていればfilteredに設定された文字列が表示される(検証済み)

    単にstring型で置き換えることもできるが、内部的にはraw下に設定されているらしく/data get等で観測すると{raw:"<入力した文字列>"}というかたちになって返ってくる

対応例
  1. 1.20.4
    {id:"minecraft:writable_book",tag:{pages:["1ページ目","2ページ目"]}}
    
    1.20.5
    {id:"minecraft:writable_book",components:{"minecraft:writable_book_content":{pages:[{raw:"1ページ目"},{raw:"2ページ目"}]}}}
    
    #↓の書き方でも↑と同値にされる
    {id:"minecraft:writable_book",components:{"minecraft:writable_book_content":{pages:["1ページ目","2ページ目"]}}}
    

記入済みの本(written_book)

minecraft:written_book_content={pages:[<filtered chat components>],
title:<filtered string>,author:<string>,generation:<int>,resolved:<boolean>}
  • pages
    pages: [<filtered chat components>]

    pagesの中身が filtered chat componentと呼ばれるデータ構造に変更されている

    • filtered chat component {raw:'<chat_component>',filtered:'<chat_component>'}

      rawは必須だがfilteredは任意で設定するタグとなっている
      writable_bookと違い、こちらには単なるstring型ではなくchat componentを記述する

      基本的にはrawに設定されたchat componentが表示されるが、MinecraftアカウントJAVA REALMS PROFANITY FILTERという設定が有効になっていればfilteredに設定されたchat componentが表示される(検証済み)

      filtered string同様、単なるchat component(例:'{"text":"HelloWorld"}')で置き換えても↑の形で保存されている

  • title
    title: <filtered string>

  • author
    author: <string>

  • generation
    generation: <int> (0~3)

  • resolved
    resolved: <byte> (0b or 1b)

対応例
  1. 1.20.4
    {id:"minecraft:written_book",tag:{pages:['{"text":"1ページ目"}','{"text":"2ページ目"}'],title:"タイトル",author:"著者名",generation:0,resolved:0b}}
    
    1.20.5
    {id:"minecraft:written_book",components:{"minecraft:written_book_content":{pages:[{raw:'{"text":"1ページ目"}'},{raw:'{"text":"2ページ目"}'}],title:{raw:"タイトル"},author:"著者名",generation:0,resolved:0b}}}
    
    #↓の書き方でも↑と同値にされる
    {id:"minecraft:written_book",components:{"minecraft:written_book_content":{pages:['{"text":"1ページ目"}','{"text":"2ページ目"}'],title:"タイトル",author:"著者名",generation:0,resolved:0b}}}
    

Potion

minecraft:potion_contents=<string>

対応例
  1. 1.20.4
    {tag:{Potion:"minecraft:swiftness"}}
    
    1.20.5
    {components:{"minecraft:potion_contents":"minecraft:swiftness"}}
    
    #省略しない形↓
    {components:{"minecraft:potion_contents":{potion:"minecraft:swiftness"}}}
    

Recipes

minecraft:recipes=[]

対応例
  1. 1.20.4
    {tag:{Recipes:["minecraft:jungle_planks"]}}
    
    1.20.5
    {components:{"minecraft:recipes":["minecraft:jungle_planks"]}}
    

resolved

minecraft:written_book_contentcomponentに統合された

RepairCost

minecraft:repair_cost=<int>(0以上)

  • 負の値を指定できなくなった
  • 39以上の値を設定しても38が設定されているような振る舞いをする
対応例
  1. 1.20.4
    {tag:{RepairCost:1}}
    
    1.20.5
    {components:{"minecraft:repair_cost":1}}
    

SkullOwner

minecraft:profile=<string>

合わせてplayer_headブロック側のNBTもSkullOwnerからprofileへ変わり、
中身も下記のcomponent内と同様の記述に変わっている

詳細
  • Name
    name: <string> (player名, 16文字まで)

  • Id
    id: <int_array> (uuid)

  • Properties.textures
    properties[{name:"textures"}]

    • Value
      properties[{name:"textures"}].value
    • Signature
      properties[{name:"textures"}].signature
対応例
  1. 1.20.4
    {tag:{SkullOwner:{Name:"CobwebbyPiano58",Properties:{textures:[{Value:"ewogICJ0aW1lc3RhbXAiIDogMCwKICAicHJvZmlsZUlkIiA6ICI5NDI1YTRhYzRlNzQ0NDZiOTgxMzYzYzQxYTM5NmQ4NyIsCiAgInByb2ZpbGVOYW1lIiA6ICJDb2J3ZWJieVBpYW5vNTgiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiBmYWxzZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzdiZGM0YjJmZDJmZmI4MDlmNzdiNGJlYTlmZTM0ZjllODBjMWJmNDJjODUyMjc5NTQwMmY5NzNjMGEwOTg2NTIiCiAgICB9CiAgfQp9"}]}}}}
    
    1.20.5
    {components:{"minecraft:profile":{name:"CobwebbyPiano58",properties:[{name:"textures", value:"ewogICJ0aW1lc3RhbXAiIDogMCwKICAicHJvZmlsZUlkIiA6ICI5NDI1YTRhYzRlNzQ0NDZiOTgxMzYzYzQxYTM5NmQ4NyIsCiAgInByb2ZpbGVOYW1lIiA6ICJDb2J3ZWJieVBpYW5vNTgiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiBmYWxzZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzdiZGM0YjJmZDJmZmI4MDlmNzdiNGJlYTlmZTM0ZjllODBjMWJmNDJjODUyMjc5NTQwMmY5NzNjMGEwOTg2NTIiCiAgICB9CiAgfQp9"}]}}}
    
    #SkullOwnerと同じく、プレイヤー名だけでもresolveしてくれる
    {components:{"minecraft:profile":"CobwebbyPiano58"}}
    

StoredEnchantments

minecraft:stored_enchantments={<id>:<int>}

(minecraft:enchantmentscomponentと同じ書き方)

対応例
  1. 1.20.4
    {tag:{StoredEnchantments:[{id:"minecraft:mending",lvl:1s}]}}
    
    1.20.5
    {components:{"minecraft:stored_enchantments":{levels:{'minecraft:mending':1}}}}
    

title

minecraft:written_book_contentcomponentに統合された

Trim

minecraft:trim=<component>

中身の書き方に変更はなく、
#minecraft:trimmable_armor item tagに含まれないアイテムにも付与できるようになった

詳細
  • pattern
    pattern: <string> (trim_pattern id)

  • material
    material: <string> (trim_material id)

対応例
  1. 1.20.4
    {tag:{Trim:{pattern:"minecraft:spire",material:"minecraft:redstone"}}}
    
    1.20.5
    {components:{"minecraft:trim":{pattern:"minecraft:spire",material:"minecraft:redstone"}}}
    

Unbreakable

minecraft:unbreakable={}

{Unbreakable:0b}の状態は
minecraft:unbreakablecomponentを記述しないことでしか表現できなくなった

対応例
  1. 1.20.4
    {tag:{Unbreakable:1b}}
    
    1.20.5
    {components:{"minecraft:unbreakable":{}}}
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0