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 resource packs #1603

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions __snapshots__/packages/java-edition/test-out/binder/index.spec.js

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

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

8 changes: 8 additions & 0 deletions packages/core/src/service/fileUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ export namespace fileUtil {
return i >= 0 ? uri.slice(i + 1) : uri
}

/**
* @returns The part from the beginning of the URI to the last `/`.
*/
export function dirname(uri: string): string {
const i = uri.lastIndexOf('/')
return i >= 0 ? uri.slice(0, i) : uri
}

/* istanbul ignore next */
export function getParentOfFile(externals: Externals, path: FsLocation): FsLocation {
return new Uri('.', path)
Expand Down
65 changes: 57 additions & 8 deletions packages/core/src/symbol/Symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ export const TagFileCategories = Object.freeze(
)
export type TagFileCategory = (typeof TagFileCategories)[number]

export const FileCategories = Object.freeze(
export const DataFileCategories = Object.freeze(
[...NormalFileCategories, ...TagFileCategories, ...WorldgenFileCategories] as const,
)
export type FileCategory = (typeof FileCategories)[number]
export type DataFileCategory = (typeof DataFileCategories)[number]

export const MiscCategories = Object.freeze(
export const DataMiscCategories = Object.freeze(
[
'attribute_modifier',
'bossbar',
Expand All @@ -184,7 +184,7 @@ export const MiscCategories = Object.freeze(
'storage',
] as const,
)
export type MiscCategory = (typeof MiscCategories)[number]
export type DataMiscCategory = (typeof DataMiscCategories)[number]

export const DatapackCategories = Object.freeze(
[
Expand All @@ -193,22 +193,71 @@ export const DatapackCategories = Object.freeze(
'score_holder',
'tag',
'team',
...FileCategories,
...MiscCategories,
...DataFileCategories,
...DataMiscCategories,
] as const,
)
export type DatapackCategory = (typeof DatapackCategories)[number]
// #endregion

// #region Resource Pack Categories
export const AssetsFileCategories = Object.freeze(
[
'atlas',
'block_definition', // blockstates
'font',
'font/ttf',
'font/otf',
'font/unihex',
'lang',
'model',
'particle',
'post_effect',
'shader',
'shader/fragment',
'shader/vertex',
'sound',
'texture',
] as const,
)
export type AssetsFileCategory = (typeof AssetsFileCategories)[number]

export const AssetsMiscCategories = Object.freeze(
[
'shader_target',
] as const,
)
export type AssetsMiscCategory = (typeof AssetsMiscCategories)[number]

export const ResourcepackCategories = Object.freeze(
[
...AssetsMiscCategories,
...AssetsFileCategories,
] as const,
)
export type ResourcepackCategory = (typeof ResourcepackCategories)[number]
// #endregion

export const FileCategories = Object.freeze(
[...DataFileCategories, ...AssetsFileCategories] as const,
)
export type FileCategory = (typeof FileCategories)[number]

export const AllCategories = Object.freeze(
[...DatapackCategories, ...McdocCategories, ...RegistryCategories] as const,
[
...DatapackCategories,
...ResourcepackCategories,
...McdocCategories,
...RegistryCategories,
] as const,
)
export type AllCategory = (typeof AllCategories)[number]

export const ResourceLocationCategories = Object.freeze(
[
'mcdoc/dispatcher',
...MiscCategories,
...DataMiscCategories,
...AssetsMiscCategories,
...FileCategories,
...RegistryCategories,
] as const,
Expand Down
Loading
Loading