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

minecraft:block_placer > replace_block_item validation #282

Open
Xterionix opened this issue Nov 25, 2024 · 7 comments
Open

minecraft:block_placer > replace_block_item validation #282

Xterionix opened this issue Nov 25, 2024 · 7 comments

Comments

@Xterionix
Copy link
Contributor

The field requires that the block that is being placed matches the id of the item for the replace_block_item field to be valid.

I'd do this myself, but after going through BehaviorPack/Item/components/diagnose.ts I'm not sure how to access the item's identifier from the component test aside from calling diagnoser.document.getText() and parsing the JSON again. Seems redundant to parse it again since it's already been done in the entry.ts file

@DaanV2
Copy link
Contributor

DaanV2 commented Nov 25, 2024

Do you have a json example of what you mean? Hard time visualizing it atm

@Xterionix
Copy link
Contributor Author

Xterionix commented Nov 27, 2024

If this is the item.json and test:block is a custom block

{
  "format_version": "1.20.80",
  "minecraft:item": {
    "description": {
      "identifier": "test:block"
    },
    "components": {
      "minecraft:block_placer": {
        "block": "test:block",
        "replace_block_item": true
      }
    }
  }
}

minecraft:block_placer.block needs to equal minecraft:item.description.identifier if replace_block_item is true

@DaanV2
Copy link
Contributor

DaanV2 commented Nov 27, 2024

Does it need to match? As per the documentation it just specifies a block. Do we need to check it equals the item, or the just an exiting block

https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_block_placer?view=minecraft-bedrock-stable

@Xterionix
Copy link
Contributor Author

Note: the identifier for this item must match the block's identifier for this field to be valid.
In reference to replace_block_item ^

It needs to match

@Xterionix
Copy link
Contributor Author

On a similar note, for minecraft:custom_components format version needs to be >= 1.21.10 and I'd like to include a check for that as well, so I'd need access to the item.json from within the component test

@DaanV2
Copy link
Contributor

DaanV2 commented Nov 28, 2024

I'll see if I can get some time on updating the framework, so you can easily add those checks

@Xterionix
Copy link
Contributor Author

Great. Thank you

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