Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't like interact_button #27

Open
tryashtar opened this issue Aug 7, 2024 · 1 comment
Open

Doesn't like interact_button #27

tryashtar opened this issue Aug 7, 2024 · 1 comment

Comments

@tryashtar
Copy link

tryashtar commented Aug 7, 2024

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
Copy link

MKokeshi commented Aug 8, 2024

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:

  • text: The text displayed on the button.
  • action: The action that occurs when the button is pressed. This could be actions like open_inventory, activate, etc. Make sure to use valid actions supported by Minecraft.

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:

  • "text" is set to "Press me!", which is the text displayed on the button.
  • "action" is set to "open_inventory", which specifies that pressing the button will open the inventory. Adjust the action according to your needs.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants