手册:@minecraft/server/ItemComponentTypeMap

来自Minecraft基岩版开发Wiki

ItemComponentTypeMap包含了各物品组件类型的别名映射。

映射[编辑]

别名
cooldown ItemCooldownComponent
durability ItemDurabilityComponent
enchantments ItemEnchantsComponent
food ItemFoodComponent
minecraft:cooldown ItemCooldownComponent
minecraft:durability ItemDurabilityComponent
minecraft:enchantments ItemEnchantsComponent
minecraft:food ItemFoodComponent

代码[编辑]

type ItemComponentTypeMap = {
  'cooldown': ItemCooldownComponent;
  'durability': ItemDurabilityComponent;
  'enchantments': ItemEnchantsComponent;
  'food': ItemFoodComponent;
  'minecraft:cooldown': ItemCooldownComponent;
  'minecraft:durability': ItemDurabilityComponent;
  'minecraft:enchantments': ItemEnchantsComponent;
  'minecraft:food': ItemFoodComponent;
};