VOOZH about

URL: https://minecraft.wiki/w/Template:Default_data_component

โ‡ฑ Template:Default data component โ€“ Minecraft Wiki


Template:Default data component

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]
This template uses Module:Default data component, a script written in Lua.
This template is a work in progress.
 
Please help expand and improve it. The talk page may contain suggestions.

Creates the list of default data components for an item, based on its ID.

Data originates from item_components/data.json.

  • |1= โ€“ the item ID, without the minecraft: namespace. A valid ID is required.
  • |2= to |8= โ€“ if it is one of the values โ€‹โ€‹below, adjust the list format. The order doesn't matter, it only needs to be between parameters 2 and 8:
    • big โ€“ All basic components appear (components that by default are all items a priori, but this can change)
      • For example, max_item_stack: 64 is a basic components, as all items have it by default. However, some items have it set to 16 or 1; in these cases, max_item_stack will appear in the small list.
      • The basic components are separated in a collapsed box. See |basic=.
    • open โ€“ The list is not collapsed.
    • minecraft โ€“ Adds the minecraft: namespace to the components.
    • link โ€“ Each component will have a link to its respective section.
    • Note: Setting one of these parameters at a given moment will set it for all subsequent uses of the template on the page.
      • But the parameters small, collapsed, nominecraft and nolink respectively remove the effects.
  • |none= โ€“ text that appears next to empty lists or compounds.
  • |text= โ€“ text that appears next to the first line. Useful for describing the list.
    • It is recommended to start with space ({{space}}).
    • The final result replaces (%id) with the item ID (defined by |1=)
  • |comma= โ€“ text used at the end of each value, such as ,. Useful for separating lines.
  • |dot= โ€“ text used at the end value (of the lists or compounds), such as ..
    • If the last component is empty, instead of just appearing as none, it appears as none by replacing the last occurrence of a comma (if it exists) with dot.
  • |basic= โ€“ text used at the basic components box. Default Basic components:
    • If basic is nil the basic components were no longer kept in a separate box.
  • |basic2= โ€“ text used in the component boxes present in all items, but which for this id has a different value from the default.
    • Default nil. This means that by default the box does not exist.
  • |basiccollapsed= โ€“ Determines whether or not the boxes of the basic components should be collapsed. Default 0.
    • 1 or 3 โ€“ the |basic= box will be opened.
    • 2 or 3 โ€“ the |basic2= box will be opened.

The parameters |none=, |text=, |comma= and |dot= are all empty by default. Setting any parameters (except |1=) for a page template will set them for all subsequent page templates unless changed.

Examples

[edit source]
Observe how one example can influence another when defining parameters.
 
Therefore, the same examples could have different results at the beginning of the page.

1. {{|redstone}} results in:

  • [NBT Compound / JSON Object] components:
    • [String] item_model: "minecraft:redstone"
    • [NBT Compound / JSON Object] item_name:
      • [String] translate: "item.minecraft.redstone"
    • [String] provides_trim_material: "minecraft:redstone"


2. {{|redstone|big|open|minecraft|link}} results in:


3.{{|golden_spear}} results in:

  • [NBT Compound / JSON Object] components:
    • Basic components:
    • [NBT Compound / JSON Object] minecraft:attack_range:
      • [Float] hitbox_margin: 0.125f
      • [Float] max_creative_reach: 6.5f
      • [Float] max_reach: 4.5f
      • [Float] min_creative_reach: 2.0f
      • [Float] min_reach: 2.0f
      • [Float] mob_factor: 0.5f
    • [NBT List / JSON Array] minecraft:attribute_modifiers:
      • [NBT Compound / JSON Object]:
        • [Float] amount: 0.0f
        • [String] id: "minecraft:base_attack_damage"
        • [String] operation: "add_value"
        • [String] slot: "mainhand"
        • [String] type: "minecraft:attack_damage"
      • [NBT Compound / JSON Object]:
        • [Float] amount: -2.9473683834076f
        • [String] id: "minecraft:base_attack_speed"
        • [String] operation: "add_value"
        • [String] slot: "mainhand"
        • [String] type: "minecraft:attack_speed"
    • [Int] minecraft:damage: 0
    • [String] minecraft:damage_type: "minecraft:spear"
    • [NBT Compound / JSON Object] minecraft:enchantable:
      • [Int] value: 22
    • [String] minecraft:item_model: "minecraft:golden_spear"
    • [NBT Compound / JSON Object] minecraft:item_name:
      • [String] translate: "item.minecraft.golden_spear"
    • [NBT Compound / JSON Object] minecraft:kinetic_weapon:
      • [NBT Compound / JSON Object] damage_conditions:
        • [Int] max_duration_ticks: 275
        • [Float] min_relative_speed: 4.6f
      • [Float] damage_multiplier: 0.7f
      • [Int] delay_ticks: 14
      • [NBT Compound / JSON Object] dismount_conditions:
        • [Int] max_duration_ticks: 70
        • [Float] min_speed: 13.0f
      • [Float] forward_movement: 0.38f
      • [String] hit_sound: "minecraft:item.spear.hit"
      • [NBT Compound / JSON Object] knockback_conditions:
        • [Int] max_duration_ticks: 170
        • [Float] min_speed: 5.1f
      • [String] sound: "minecraft:item.spear.use"
    • [Int] minecraft:max_damage: 32
    • [Int] minecraft:max_stack_size: 1
    • [Float] minecraft:minimum_attack_charge: 1.0f
    • [NBT Compound / JSON Object] minecraft:piercing_weapon:
      • [String] hit_sound: "minecraft:item.spear.hit"
      • [String] sound: "minecraft:item.spear.attack"
    • [NBT Compound / JSON Object] minecraft:repairable:
      • [String] items: "#minecraft:gold_tool_materials"
    • [NBT Compound / JSON Object] minecraft:swing_animation:
      • [Int] duration: 19
      • [String] type: "stab"
    • [NBT Compound / JSON Object] minecraft:use_effects:
      • [Boolean] can_sprint: true
      • [Boolean] interact_vibrations: false
      • [Float] speed_multiplier: 1.0f
    • [NBT Compound / JSON Object] minecraft:weapon:


4.{{|golden_spear|small|collapsed|nominecraft|nolink}} results in:

  • [NBT Compound / JSON Object] components:
    • [NBT Compound / JSON Object] attack_range:
      • [Float] hitbox_margin: 0.125f
      • [Float] max_creative_reach: 6.5f
      • [Float] max_reach: 4.5f
      • [Float] min_creative_reach: 2.0f
      • [Float] min_reach: 2.0f
      • [Float] mob_factor: 0.5f
    • [NBT List / JSON Array] attribute_modifiers:
      • [NBT Compound / JSON Object]:
        • [Float] amount: 0.0f
        • [String] id: "minecraft:base_attack_damage"
        • [String] operation: "add_value"
        • [String] slot: "mainhand"
        • [String] type: "minecraft:attack_damage"
      • [NBT Compound / JSON Object]:
        • [Float] amount: -2.9473683834076f
        • [String] id: "minecraft:base_attack_speed"
        • [String] operation: "add_value"
        • [String] slot: "mainhand"
        • [String] type: "minecraft:attack_speed"
    • [Int] damage: 0
    • [String] damage_type: "minecraft:spear"
    • [NBT Compound / JSON Object] enchantable:
      • [Int] value: 22
    • [String] item_model: "minecraft:golden_spear"
    • [NBT Compound / JSON Object] item_name:
      • [String] translate: "item.minecraft.golden_spear"
    • [NBT Compound / JSON Object] kinetic_weapon:
      • [NBT Compound / JSON Object] damage_conditions:
        • [Int] max_duration_ticks: 275
        • [Float] min_relative_speed: 4.6f
      • [Float] damage_multiplier: 0.7f
      • [Int] delay_ticks: 14
      • [NBT Compound / JSON Object] dismount_conditions:
        • [Int] max_duration_ticks: 70
        • [Float] min_speed: 13.0f
      • [Float] forward_movement: 0.38f
      • [String] hit_sound: "minecraft:item.spear.hit"
      • [NBT Compound / JSON Object] knockback_conditions:
        • [Int] max_duration_ticks: 170
        • [Float] min_speed: 5.1f
      • [String] sound: "minecraft:item.spear.use"
    • [Int] max_damage: 32
    • [Int] max_stack_size: 1
    • [Float] minimum_attack_charge: 1.0f
    • [NBT Compound / JSON Object] piercing_weapon:
      • [String] hit_sound: "minecraft:item.spear.hit"
      • [String] sound: "minecraft:item.spear.attack"
    • [NBT Compound / JSON Object] repairable:
      • [String] items: "#minecraft:gold_tool_materials"
    • [NBT Compound / JSON Object] swing_animation:
      • [Int] duration: 19
      • [String] type: "stab"
    • [NBT Compound / JSON Object] use_effects:
      • [Boolean] can_sprint: true
      • [Boolean] interact_vibrations: false
      • [Float] speed_multiplier: 1.0f
    • [NBT Compound / JSON Object] weapon:


5.{{|golden_apple|text={{space}}list of {{cd|(%id)}} default components|basic=nil}} results in:

  • [NBT Compound / JSON Object] components: list of golden_apple default components
    • [NBT Compound / JSON Object] consumable:
      • [NBT List / JSON Array] on_consume_effects:
        • [NBT Compound / JSON Object]:
          • [NBT List / JSON Array] effects:
            • [NBT Compound / JSON Object]:
              • [Byte] amplifier: 1b
              • [Int] duration: 100
              • [String] id: "minecraft:regeneration"
              • [Boolean] show_icon: true
            • [NBT Compound / JSON Object]:
              • [Int] duration: 2400
              • [String] id: "minecraft:absorption"
              • [Boolean] show_icon: true
          • [String] type: "minecraft:apply_effects"
    • [NBT Compound / JSON Object] food:
      • [Boolean] can_always_eat: true
      • [Int] nutrition: 4
      • [Float] saturation: 9.6f
    • [String] item_model: "minecraft:golden_apple"
    • [NBT Compound / JSON Object] item_name:
      • [String] translate: "item.minecraft.golden_apple"


6.{{|command_block|big|none=None}} results in:

  • [NBT Compound / JSON Object] components: list of command_block default components
    • [NBT List / JSON Array] attribute_modifiers:None
    • [String] break_sound: "minecraft:entity.item.break"
    • [NBT Compound / JSON Object] enchantments:None
    • [String] item_model: "minecraft:command_block"
    • [NBT Compound / JSON Object] item_name:
      • [String] translate: "block.minecraft.command_block"
    • [NBT List / JSON Array] lore:None
    • [Int] max_stack_size: 64
    • [String] rarity: "epic"
    • [Int] repair_cost: 0
    • [NBT Compound / JSON Object] swing_animation:None
    • [NBT Compound / JSON Object] tooltip_display:None
    • [NBT Compound / JSON Object] use_effects:None


7.{{|red_dye|text=&โ€Œzwnj;|comma=;|dot=!}} results in:

  • [NBT Compound / JSON Object] components:โ€Œ
    • [NBT List / JSON Array] attribute_modifiers:None
    • [String] break_sound: "minecraft:entity.item.break";
    • [String] dye: "red";
    • [NBT Compound / JSON Object] enchantments:None
    • [String] item_model: "minecraft:red_dye";
    • [NBT Compound / JSON Object] item_name:
      • [String] translate: "item.minecraft.red_dye";
    • [NBT List / JSON Array] lore:None
    • [Int] max_stack_size: 64;
    • [String] rarity: "common";
    • [Int] repair_cost: 0;
    • [NBT Compound / JSON Object] swing_animation:None
    • [NBT Compound / JSON Object] tooltip_display:None
    • [NBT Compound / JSON Object] use_effects:None


8.{{|stone|basic=Common components|comma=,|dot=.|basic2=Common components2}} results in:

  • [NBT Compound / JSON Object] components:โ€Œ
    • Common components
      • [NBT List / JSON Array] attribute_modifiers:None
      • [String] break_sound: "minecraft:entity.item.break",
      • [NBT Compound / JSON Object] enchantments:None
      • [NBT List / JSON Array] lore:None
      • [Int] max_stack_size: 64,
      • [String] rarity: "common",
      • [Int] repair_cost: 0,
      • [NBT Compound / JSON Object] swing_animation:None
      • [NBT Compound / JSON Object] tooltip_display:None
      • [NBT Compound / JSON Object] use_effects:None
    • Common components2
      • [String] item_model: "minecraft:stone",
      • [NBT Compound / JSON Object] item_name:
        • [String] translate: "block.minecraft.stone".


9.{{|decorated_pot|none={{space}}none,|basiccollapsed=3}} results in:

  • [NBT Compound / JSON Object] components:โ€Œ
    • Common components
      • [NBT List / JSON Array] attribute_modifiers: none,
      • [String] break_sound: "minecraft:entity.item.break",
      • [NBT Compound / JSON Object] enchantments: none,
      • [NBT List / JSON Array] lore: none,
      • [Int] max_stack_size: 64,
      • [String] rarity: "common",
      • [Int] repair_cost: 0,
      • [NBT Compound / JSON Object] swing_animation: none,
      • [NBT Compound / JSON Object] tooltip_display: none,
      • [NBT Compound / JSON Object] use_effects: none,
    • Common components2
      • [String] item_model: "minecraft:decorated_pot",
      • [NBT Compound / JSON Object] item_name:
        • [String] translate: "block.minecraft.decorated_pot",
    • [NBT List / JSON Array] container: none,
    • [NBT List / JSON Array] pot_decorations:


10.{{|redstone_dust}} results in: [Undefined] Module error: redstone_dust is an invalid ID. See Java Edition data values/Items or Java Edition data values/Blocks


11. In {{||redstone}}, no ID was defined (in |1=), so it results as if it were the air item:

  • [NBT Compound / JSON Object] components:โ€Œ
    • Common components
      • [NBT List / JSON Array] attribute_modifiers: none,
      • [String] break_sound: "minecraft:entity.item.break",
      • [NBT Compound / JSON Object] enchantments: none,
      • [NBT List / JSON Array] lore: none,
      • [Int] max_stack_size: 64,
      • [String] rarity: "common",
      • [Int] repair_cost: 0,
      • [NBT Compound / JSON Object] swing_animation: none,
      • [NBT Compound / JSON Object] tooltip_display: none,
      • [NBT Compound / JSON Object] use_effects: none,
    • Common components2
      • [String] item_model: "minecraft:air",
      • [NBT Compound / JSON Object] item_name:
        • [String] translate: "block.minecraft.air".
[view] [edit] [history] [purge]The above documentation is transcluded from Template:Default data component/doc.
Retrieved from "https://minecraft.wiki/w/Template:Default_data_component?oldid=3633817"

Navigation menu