mojira.dev
MCPE-237334

Scripting API: getComponent("minecraft:dyeable") returns undefined on custom items despite being defined in JSON behavior

When using the Scripting API, attempting to retrieve the minecraft:dyeable component from a custom item returns undefined, even though the component is explicitly defined in the item's behavior JSON file.

​Steps to Reproduce:

​Create a custom item behavior pack and include the minecraft:dyeable component in the item JSON (format version 1.26.0).

​Apply the pack to a world and obtain the custom item (hn:custom_armor) in-game.

​Use the Scripting API to get the ItemStack of the custom item.

​Attempt to fetch the dyeable component using this code:

const dye = item.getComponent("minecraft:dyeable");

​Check the result using:

console.warn(dye);

​Observed Results:

The console outputs [Scripting][warning]-undefined. The API fails to recognize the component on the custom item, making it impossible to read or modify properties like dye.color via script.

​Expected Results:

The getComponent function should successfully return the ItemDyeableComponent object as defined in the custom item's JSON, allowing color manipulation.

item.json

{
  "format_version": "1.26.0",
  "minecraft:item": {
    "description": {
      "identifier": "hn:custom_armor",
      "menu_category": { "category": "items" }
    },
    "components": {
      "minecraft:record": {
        "duration": 3600.0,
        "comparator_signal": 15
      },
      "minecraft:max_stack_size": 1,
      "minecraft:icon": {
        "textures": { "default": "custom_armor", "dyed": "custom_armor_gray" }
      },
      "minecraft:display_name": {
        "value": "Custom Armor"
      },
      "minecraft:dyeable": { "default_color": "#ffffff" }
    }
  }
}

Attachments

Comments 3

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Could you please attach an example addon showcasing the issue?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

[media]

simple testing

Hold the hn:custom_dyeable item, right-click to use it, and check the Content Log

HanNajib

(Unassigned)

1587909

Confirmed

Windows

11 23H2

26.3

Retrieved