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

Allow two variations of syntax in fromString #96

Merged
merged 2 commits into from
Mar 17, 2024

Conversation

Flonja
Copy link
Contributor

@Flonja Flonja commented Dec 31, 2023

Refer to PrismarineJS/prismarine-chunk#230 (comment) for reason.

For the short reasoning:
It now allows bedrock data to also be able to use the java edition format. (like minecraft:candle[lit=true])

index.js Show resolved Hide resolved
@rom1504
Copy link
Member

rom1504 commented Jan 6, 2024

I understand little to none about what is going on here and in PrismarineJS/prismarine-chunk#230

so if you want this merged, it'd have to be explained in comments and maybe also in PR descriptions @Flonja @extremeheat (for me, but also for future people wanting to understand what that PR did)

@extremeheat
Copy link
Member

Basically the goal is to convert a string like

minecraft:candle[lit=true] to a prismarine-block instance with the correct block state.

That's the syntax that we use in minecraft-data like in https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/common/legacy.json or https://github.com/PrismarineJS/minecraft-data/blob/master/data/bedrock/1.19.1/blocksB2J.json

This would be the same as

Block.fromProperties('minecraft:candle', { lit: true })

What #71 did I believe was add another syntax for this, but just for bedrock: minecraft:candle["lit":true]

This uses : colons with keys wrapped in quotations instead of =. But since we don't use this syntax in minecraft-data I suggested checking against the syntax as opposed to the version type which is unrelated to the string syntax

@Flonja Flonja requested a review from rom1504 January 11, 2024 15:50
@rom1504 rom1504 merged commit 52fda55 into PrismarineJS:master Mar 17, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants