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

✨ Add support for item components #1131

Merged
merged 28 commits into from
Jun 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
52740d3
begin work
Trivaxy May 11, 2024
dc6c238
potentially fix error
Trivaxy May 11, 2024
bd7d1a6
make ParticleNode refer to ItemNode
Trivaxy May 11, 2024
6c8fdff
Rudimentary item component syntax support
Trivaxy May 12, 2024
3e0f112
✨ Implement various command parsers and tree patch changes (#1128)
misode May 12, 2024
4e05d80
fix `ItemOldNode.is` and `ItemNewNode.is`
Trivaxy May 13, 2024
797cfdf
report error when duplicate components are defined
Trivaxy May 13, 2024
ea2a2cb
make duplicate components error localize properly
Trivaxy May 13, 2024
6f975f3
make error for duplicate components consistent
Trivaxy May 13, 2024
e51dad1
make error reporting for duplicates smarter
Trivaxy May 13, 2024
0b3af75
rename `item_old` and `item_new`
Trivaxy May 13, 2024
27c395a
(very buggy) new item predicate syntax
Trivaxy May 17, 2024
4697366
undo changes to `list.ts`
Trivaxy May 17, 2024
e4bd254
Merge branch 'main' into pr/Trivaxy/1131-1
misode May 30, 2024
11a5537
Implement a few of SPGoding's suggestions
misode May 30, 2024
a5752fd
Refactor nodes to separate item stack and predicate instead of old an…
misode May 30, 2024
05f1010
Remove unused function
misode May 30, 2024
6ed3a53
Update snapshots
misode May 30, 2024
28be8e5
Use correct symbol categories + change duplicate check
misode May 30, 2024
3d8f860
Start of completers
misode May 30, 2024
a6d7d51
Refactor component test parser
misode May 30, 2024
8612a2e
fix equality component tests only expecting compounds
Trivaxy Jun 15, 2024
0b89a61
finish item predicates
Trivaxy Jun 15, 2024
89cdf23
Merge remote-tracking branch 'upstream/main' into item-components
Trivaxy Jun 15, 2024
e6f6a5d
fix weird merge
Trivaxy Jun 15, 2024
f0077d7
fix linting
Trivaxy Jun 15, 2024
5cfdfa1
return component test nodes to being infallible
Trivaxy Jun 15, 2024
3be2227
... fix lint. i forgot to make this automatic
Trivaxy Jun 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
... fix lint. i forgot to make this automatic
Trivaxy committed Jun 15, 2024
commit 3be2227e0d43091fb78c169f39c99d15c9820b02
10 changes: 8 additions & 2 deletions packages/java-edition/src/mcfunction/parser/argument.ts
Original file line number Diff line number Diff line change
@@ -1858,7 +1858,10 @@ const componentTest: core.InfallibleParser<ComponentTestNode> = (src, ctx) => {
src.skipWhitespace()

if (src.trySkip('=')) {
let value: core.Result<nbt.NbtNode> | undefined = nbt.parser.entry(src, ctx);
let value: core.Result<nbt.NbtNode> | undefined = nbt.parser.entry(
src,
ctx,
)

if (value == core.Failure) {
ctx.err.report(localize('expected', localize('nbt.node')), src)
@@ -1879,7 +1882,10 @@ const componentTest: core.InfallibleParser<ComponentTestNode> = (src, ctx) => {
}
if (src.trySkip('~')) {
resLoc.options.category = 'item_sub_predicate_type'
let predicate: core.Result<nbt.NbtNode> | undefined = nbt.parser.entry(src, ctx)
let predicate: core.Result<nbt.NbtNode> | undefined = nbt.parser.entry(
src,
ctx,
)

if (predicate == core.Failure) {
ctx.err.report(localize('expected', localize('nbt.node')), src)