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

Check if valid block and item being used #206

Open
Xterionix opened this issue May 29, 2024 · 6 comments
Open

Check if valid block and item being used #206

Xterionix opened this issue May 29, 2024 · 6 comments

Comments

@Xterionix
Copy link
Contributor

For entity components that reference items and blocks, it should check if they're valid. Happy to do this myself if you could point me in the direction as I believe it's already setup to check for valid blocks and items just not within the entity components

@DaanV2
Copy link
Contributor

DaanV2 commented May 30, 2024

@Xterionix
Copy link
Contributor Author

I'm not sure what the input would be for the block check function

export function check_if_block_exists(name: string, component: any, context: Context, diagnoser: DiagnosticsBuilder): void { 
  if (component === undefined) return;
  if (component.target_blocks !== undefined && component.target_blocks instanceof Array) component.target_blocks.forEach((block: string) => behaviorpack_check_blockid(/**?**/ ,diagnoser) )

@DaanV2
Copy link
Contributor

DaanV2 commented Jun 3, 2024

Aah the Types.OffsetWord is an object that stores the text of the data found, and the offset in the file where it is located.

Here you can see any example:

if (entry.name) behaviorpack_item_diagnose(minecraft_get_item(entry.name, diagnoser.document), diagnoser);

For the diagnosed (and vscode) to place the error in a document it needs to known a location

@Xterionix
Copy link
Contributor Author

Even for checking the block Id I should get the item?

@DaanV2
Copy link
Contributor

DaanV2 commented Jun 4, 2024

No, I think we are going to need a equivalent for block on that function, don't think it exists yet.

@Xterionix
Copy link
Contributor Author

Ah, well let me know when that's been adeded

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