Mojang / minecraft-creator-tools

A set of tools for creating content and add-ons for Minecraft Bedrock Edition.
Other
66 stars 2 forks source link

Doesn't like interact_button #27

Open tryashtar opened 1 month ago

tryashtar commented 1 month ago

I got this error:

Wrong type: /minecraft:item/components/minecraft:interact_button type must be object

When using an item with this component:

"minecraft:interact_button": "test"

But if I make it an object, I get this content log error in-game:

[Item][error]- Failed to parse field ' -> components -> minecraft:interact_button: invalid value'
[Item][error]- Failed to parse field ' -> components -> minecraft:interact_button: invalid string'
MKokeshi commented 1 month ago

The error you're encountering suggests that the minecraft:interact_button component in Minecraft expects an object type, not a string. This component is used to define interactive buttons for items, and it needs to be properly formatted as an object according to Minecraft’s JSON schema.

Here’s how you can correct the format:

Correct Format for minecraft:interact_button

The minecraft:interact_button component should be formatted as an object, not a string. The object should include the required properties that define the button’s behavior. Here is an example of how you can structure this component correctly:

Example JSON

{
  "minecraft:item": {
    "components": {
      "minecraft:interact_button": {
        "text": "test",
        "action": "open_inventory"  // Replace with the correct action
      }
    }
  }
}

Common Properties for minecraft:interact_button

Depending on the functionality you want, you may need different properties. Here’s a general outline of what properties might be included:

Troubleshooting

  1. Ensure Proper Action and Properties: Make sure that the action property and any other properties you use are valid and correctly spelled. You should refer to the latest Minecraft documentation or schema for the exact properties and values.

  2. Validate JSON Structure: Ensure that your JSON structure is correct and follows the Minecraft schema. Tools like JSONLint can help validate the structure.

  3. Check for Updates: Minecraft updates can change the required properties or add new ones. Make sure you’re using the correct version of Minecraft that matches your JSON schema.

  4. Consult Documentation and Community: Review the Minecraft documentation or consult the Minecraft community for the latest information about minecraft:interact_button. The official documentation or forums may provide updated examples and properties.

Example with Action

Here’s a more specific example with an action:

{
  "minecraft:item": {
    "components": {
      "minecraft:interact_button": {
        "text": "Press me!",
        "action": "open_inventory"
      }
    }
  }
}

In this example:

If you need more specific actions or properties, please refer to the most recent Minecraft documentation or community sources.