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

🐛 Support 25w04a #1726

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
96 changes: 95 additions & 1 deletion __snapshots__/packages/nbt/test-out/parser/collection.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/core/src/symbol/Symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const RegistryCategories = Object.freeze(
'block_entity_type',
'block_predicate_type',
'block_type',
'cat_variant',
'chunk_status',
'command_argument_type',
'consume_effect_type',
Expand All @@ -41,7 +40,6 @@ export const RegistryCategories = Object.freeze(
'entity_type',
'float_provider_type',
'fluid',
'frog_variant',
'game_event',
'height_provider_type',
'instrument',
Expand Down Expand Up @@ -116,12 +114,14 @@ export const NormalFileCategories = Object.freeze(
[
'advancement',
'banner_pattern',
'cat_variant',
'chat_type',
'damage_type',
'dimension',
'dimension_type',
'enchantment',
'enchantment_provider',
'frog_variant',
'function',
'instrument',
'item_modifier',
Expand Down
2 changes: 2 additions & 0 deletions packages/java-edition/src/binder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ resource('tags/item', { category: 'tag/item', since: '1.21' })

// Data pack
resource('banner_pattern', { since: '1.20.5' })
resource('cat_variant', { since: '1.21.5' })
resource('chat_type', { since: '1.19' })
resource('damage_type', { since: '1.19.4' })
resource('enchantment', { since: '1.21' })
resource('enchantment_provider', { since: '1.21' })
resource('frog_variant', { since: '1.21.5' })
resource('instrument', { since: '1.21.2' })
resource('jukebox_song', { since: '1.21' })
resource('painting_variant', { since: '1.21' })
Expand Down
16 changes: 10 additions & 6 deletions packages/nbt/src/parser/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ export const list: core.Parser<NbtListNode> = (src, ctx) => {

// Check if every element is of the same type.
if (ans.valueType) {
for (const { value } of ans.children) {
if (value && value.type !== ans.valueType) {
ctx.err.report(
localize('expected-got', localizeTag(ans.valueType), localizeTag(value.type)),
value,
)
// TODO: don't have this inline java-edition version check
const release = ctx.project['loadedVersion'] as string | undefined
if (release && Number(release.slice(2)) < Number('1.21.5'.slice(2))) {
for (const { value } of ans.children) {
if (value && value.type !== ans.valueType) {
ctx.err.report(
localize('expected-got', localizeTag(ans.valueType), localizeTag(value.type)),
value,
)
}
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions packages/nbt/test/parser/collection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ import { describe, it } from 'mocha'
import snapshot from 'snap-shot-it'

describe('nbt list()', () => {
const suites: { content: string }[] = [{ content: '' }, { content: '[]' }, {
content: '["string"]',
}, { content: '["string", 1b]' }]
for (const { content } of suites) {
it(`Parse "${showWhitespaceGlyph(content)}"`, () => {
const suites: { content: string; version?: string }[] = [
{ content: '' },
{ content: '[]' },
{ content: '["string"]' },
{ content: '["string", 1b]', version: '1.21.4' },
{ content: '["string", 1b]', version: '1.21.5' },
]
for (const { content, version } of suites) {
it(`Parse "${showWhitespaceGlyph(content)}"${version ? ` in ${version}` : ''}`, () => {
const parser = list
snapshot(testParser(parser, content))
const ctx = version ? { project: { ctx: { loadedVersion: version } } } : undefined
snapshot(testParser(parser, content, ctx))
})
}
})
Expand Down
2 changes: 2 additions & 0 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@
"data/*/advancement/**/*.json",
"data/*/advancements/**/*.json",
"data/*/banner_pattern/**/*.json",
"data/*/cat_variant/**/*.json",
"data/*/chat_type/**/*.json",
"data/*/damage_type/**/*.json",
"data/*/dimension/**/*.json",
"data/*/dimension_type/**/*.json",
"data/*/enchantment/**/*.json",
"data/*/enchantment_provider/**/*.json",
"data/*/frog_variant/**/*.json",
"data/*/item_modifier/**/*.json",
"data/*/item_modifiers/**/*.json",
"data/*/jukebox_song/**/*.json",
Expand Down
Loading