📜  replaceitem 村民命令 minecraft 1.15 (1)

📅  最后修改于: 2023-12-03 15:19:48.381000             🧑  作者: Mango

Minecraft 1.15 命令技巧之replaceitem 村民命令

在Minecraft 1.15版本之后,新添加了一个非常有用的指令replaceitem 村民命令。replaceitem指令能够帮助玩家在村民身上添加、替换、移除物品或护甲。本篇文章将详细介绍replaceitem指令的使用方法。

基本语法

replaceitem entity <entity> slot.mainhand|slot.offhand|slot.armor.chest|slot.armor.feet|slot.armor.head|slot.armor.legs|container.<container_type>.<slot_number> <item> [amount] [data] [nbt]

  • entity: 村民实体的名称。
  • slot: 设置物品插槽,具体支持的插槽类型在后文中有具体说明。
  • item: 物品名称,可以是英文名称或ID,后文会有物品名称对应表。
  • amount: 物品数量。
  • data: 物品耐久值,一些物品有不同的耐久值,如剑、工具等。
  • nbt: 可选,nbt格式数据,用于设置物品属性。
支持的插槽类型

| 插槽类型 | 说明 | | ---------------------------- | --------------------------------------------------------- | | slot.mainhand | 主手槽 | | slot.offhand | 副手槽 | | slot.armor.chest | 身体槽 | | slot.armor.feet | 脚部槽 | | slot.armor.head | 头部槽 | | slot.armor.legs | 腿部槽 | | container.<container_type>.<slot_number> | 容器类型(如箱子、旗帜等)+插槽编号。具体支持的容器类型在后文中有具体说明。 |

支持的容器类型

| 容器名称 | 容器类型 | | ----------------------------- | --------------------------------------------------------- | | minecraft:barrel | 木桶 | | minecraft:beacon | 信标 | | minecraft:brewing_stand | 酿造台 | | minecraft:chest | 箱子 | | minecraft:dispenser | 饰品盒 | | minecraft:dropper | 投掷器 | | minecraft:furnace | 熔炉 | | minecraft:hopper | 漏斗 | | minecraft:lectern | 讲台 | | minecraft:shulker_box | 射影盒 | | minecraft:smoker | 烟熏炉 |

物品名称对应表

| 物品名称 | 物品ID | | ---------------------------- | ---------------------------------------- | | apple | minecraft:apple | | golden_apple | minecraft:golden_apple | | carrot | minecraft:carrot | | melon | minecraft:melon | | bread | minecraft:bread | | fish | minecraft:fish | | salmon | minecraft:salmon | | cooked_fish | minecraft:cooked_fish | | cooked_salmon | minecraft:cooked_salmon | | chicken | minecraft:chicken | | cooked_chicken | minecraft:cooked_chicken | | steak | minecraft:steak | | cooked_beef | minecraft:cooked_beef | | porkchop | minecraft:porkchop | | cooked_porkchop | minecraft:cooked_porkchop | | potato | minecraft:potato | | baked_potato | minecraft:baked_potato | | poisonous_potato | minecraft:poisonous_potato | | beetroot | minecraft:beetroot | | beetroot_seeds | minecraft:beetroot_seeds | | beetroot_soup | minecraft:beetroot_soup | | pumpkin_pie | minecraft:pumpkin_pie | | cookie | minecraft:cookie | | sugar | minecraft:sugar | | melon_seeds | minecraft:melon_seeds | | pumpkin_seeds | minecraft:pumpkin_seeds | | wheat_seeds | minecraft:wheat_seeds | | wheat | minecraft:wheat | | bread | minecraft:bread | | hay_bale | minecraft:hay_bale | | redstone | minecraft:redstone | | redstone_torch | minecraft:redstone_torch | | diamond | minecraft:diamond | | diamond_horse_armor | minecraft:diamond_horse_armor | | golden_horse_armor | minecraft:golden_horse_armor | | iron_horse_armor | minecraft:iron_horse_armor | | golden_apple | minecraft:golden_apple | | enchanted_golden_apple | minecraft:enchanted_golden_apple | | stick | minecraft:stick | | string | minecraft:string | | blaze_rod | minecraft:blaze_rod | | blaze_powder | minecraft:blaze_powder | | bone | minecraft:bone | | dried_kelp_block | minecraft:dried_kelp_block | | ender_eye | minecraft:ender_eye | | ender_pearl | minecraft:ender_pearl | | ghast_tear | minecraft:ghast_tear | | glowstone_dust | minecraft:glowstone_dust | | magma_cream | minecraft:magma_cream | | nether_star | minecraft:nether_star | | nether_wart | minecraft:nether_wart | | prismarine_crystals | minecraft:prismarine_crystals | | prismarine_shard | minecraft:prismarine_shard | | rabbit_foot | minecraft:rabbit_foot | | rabbit_hide | minecraft:rabbit_hide | | rabbit_stew | minecraft:rabbit_stew | | shulker_shell | minecraft:shulker_shell | | slime_ball | minecraft:slime_ball | | spider_eye | minecraft:spider_eye | | gunpowder | minecraft:gunpowder | | feather | minecraft:feather | | arrow | minecraft:arrow | | bow | minecraft:bow | | crossbow | minecraft:crossbow | | fishing_rod | minecraft:fishing_rod | | shield | minecraft:shield | | totem_of_undying | minecraft:totem_of_undying | | trident | minecraft:trident | | iron_sword | minecraft:iron_sword | | wooden_sword | minecraft:wooden_sword | | gold_sword | minecraft:gold_sword | | diamond_sword | minecraft:diamond_sword | | iron_pickaxe | minecraft:iron_pickaxe | | wooden_pickaxe | minecraft:wooden_pickaxe | | gold_pickaxe | minecraft:gold_pickaxe | | diamond_pickaxe | minecraft:diamond_pickaxe | | iron_axe | minecraft:iron_axe | | wooden_axe | minecraft:wooden_axe | | gold_axe | minecraft:gold_axe | | diamond_axe | minecraft:diamond_axe | | iron_shovel | minecraft:iron_shovel | | wooden_shovel | minecraft:wooden_shovel | | gold_shovel | minecraft:gold_shovel | | diamond_shovel | minecraft:diamond_shovel | | iron_hoe | minecraft:iron_hoe | | wooden_hoe | minecraft:wooden_hoe | | gold_hoe | minecraft:gold_hoe | | diamond_hoe | minecraft:diamond_hoe | | leather_helmet | minecraft:leather_helmet | | chainmail_helmet | minecraft:chainmail_helmet | | iron_helmet | minecraft:iron_helmet | | gold_helmet | minecraft:gold_helmet | | diamond_helmet | minecraft:diamond_helmet | | leather_chestplate | minecraft:leather_chestplate | | chainmail_chestplate | minecraft:chainmail_chestplate | | iron_chestplate | minecraft:iron_chestplate | | gold_chestplate | minecraft:gold_chestplate | | diamond_chestplate | minecraft:diamond_chestplate | | leather_leggings | minecraft:leather_leggings | | chainmail_leggings | minecraft:chainmail_leggings | | iron_leggings | minecraft:iron_leggings | | gold_leggings | minecraft:gold_leggings | | diamond_leggings | minecraft:diamond_leggings | | leather_boots | minecraft:leather_boots | | chainmail_boots | minecraft:chainmail_boots | | iron_boots | minecraft:iron_boots | | gold_boots | minecraft:gold_boots | | diamond_boots | minecraft:diamond_boots |

使用方法
在主手上添加方块物品
replaceitem entity @e[type=villager] slot.mainhand minecraft:diamond_pickaxe

以上命令可以将村民的主手槽添加一把钻石镐。

在箱子的指定插槽添加物品
replaceitem block 1 2 3 container.minecraft:chest.4 minecraft:apple 10

以上命令可以将一个坐标为(1,2,3)的箱子的第5个插槽中添加10个苹果。

在村民的身上添加附魔物品
replaceitem entity @e[type=villager] slot.armor.head diamond_helmet 1 0 {Enchantments:[{id:protection,lvl:4},{id:unbreaking,lvl:3},{id:respiration,lvl:3}],display:{Name:"My Helmet"}}

以上命令可以为村民添加一个附魔等级为4、耐久等级为3、呼吸等级为3的钻石头盔,并命名为"My Helmet"。

结语

replaceitem指令可以帮助玩家轻松地为村民添加、替换、移除物品或护甲,极大地提高了游戏的可玩性和趣味性。希望本篇文章可以对广大得MC玩家有所帮助。