-
Notifications
You must be signed in to change notification settings - Fork 187
Add block pattern parsing #1237
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
Add block pattern parsing #1237
Conversation
This reverts commit d9296b0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea where this file should be placed, so its here for now, I am open for suggestions.
This should probably be renamed to Pattern.zig if it is to remain as file-struct.
| const NeverFailingAllocator = main.heap.NeverFailingAllocator; | ||
|
|
||
| blocks: AliasTable(Entry), | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First I have implemented it as a struct within a file, but it was only thing here, so I figured it doesn't make sense to have a single struct within a file of the same name.
|
Ok, so only problem is that this file is not included in build anywhere, so I can literally write whatever and there is no way to check if it compiles. |
|
You mean like switching to f64 and breaking the alias table? |
|
Like anything, making const something that shouldn't be const, any typos, missed variable renames etc. Anyway, I will just fix whatever comes up in #1236 |
|
Please rebase this on #1249 |
|
Where should I add the import? |
|
Just locally I guess, you don't really need to add it to the PR. |
|
Seems like it compiles. |
|
Did you add it as a public import? |
|
Yes, in |
|
There must be a private import in the chain. Try importing it directly in main.zig |
|
Cool, now its fixed. |
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a small detail in the comment
## Description This pull request adds `/replace` command. The main difference from `/set` with `/mask global` is that mask specified for `/replace` is inlined, local and positive, i.e. only blocks matching the mask specified as part of `/replace` command will be affected. `/replace` ignores global masks. ``` /replace <old> <new> ``` `<old>` - expression following mask syntax (#1284), blocks which match will be affected `<new>` - expression following pattern syntax (#1237) used to fill blocks matched by `<old>` ## Examples `/replace cubyz:air cubyz:void` `/replace $leaf|cubyz:air cubyz:stone,cubyz:grass` ## Links Related to: #1214 Depends on: #1337 Depends on: #1284 --------- Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
## Description This pull request adds `/replace` command. The main difference from `/set` with `/mask global` is that mask specified for `/replace` is inlined, local and positive, i.e. only blocks matching the mask specified as part of `/replace` command will be affected. `/replace` ignores global masks. ``` /replace <old> <new> ``` `<old>` - expression following mask syntax (PixelGuys#1284), blocks which match will be affected `<new>` - expression following pattern syntax (PixelGuys#1237) used to fill blocks matched by `<old>` ## Examples `/replace cubyz:air cubyz:void` `/replace $leaf|cubyz:air cubyz:stone,cubyz:grass` ## Links Related to: PixelGuys#1214 Depends on: PixelGuys#1337 Depends on: PixelGuys#1284 --------- Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
This pull request add basic parser for block patterns similar to WE patterns.
Example patterns:
cubyz:stone,cubyz:oak_planks- randomly select between stone (weight 1) and planks (weight 1)10%cubyz:stone,90%cubyz:oak_planks- randomly select between stone (weight 10) and planks (weight 90)Extracted from #1236
Related to: #1214