Skip to content

Commit

Permalink
- Update diagnoser for separated atlas textures
Browse files Browse the repository at this point in the history
  • Loading branch information
Xterionix committed Dec 10, 2024
1 parent e388c00 commit dedfb11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const component_test: Record<string, ComponentCheck> = {
"minecraft:material_instances": (name, component, context, diagnoser) => {
Object.keys(component).forEach(value => {
const textureId = component[value].texture;
if (!diagnoser.context.getCache().resourcePacks.textures.find(val => val.id == textureId && val.location.uri.includes('terrain_texture')))
if (!diagnoser.context.getCache().resourcePacks.terrainTextures.find(val => val.id == textureId))
diagnoser.add(textureId,
`Texture reference "${textureId}" was not defined in terrain_texture.json`,
DiagnosticSeverity.error,
Expand Down
4 changes: 2 additions & 2 deletions src/Lib/Diagnostics/BehaviorPack/Item/components/diagnose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ const component_test: Record<string, ComponentCheck> = {
"minecraft:icon": (name, component, context, diagnoser) => {
if (typeof component == 'string') {
const textureId = component
if (!diagnoser.context.getCache().resourcePacks.textures.find(val => val.id == textureId && val.location.uri.includes('item_texture')))
if (!diagnoser.context.getCache().resourcePacks.itemTextures.find(val => val.id == textureId))
diagnoser.add(textureId,
`Texture reference "${textureId}" was not defined in item_texture.json`,
DiagnosticSeverity.error,
'behaviorpack.item.components.texture_not_found')
} else {
Object.keys(component.textures)?.forEach(value => {
const textureId = component.textures[value];
if (!diagnoser.context.getCache().resourcePacks.textures.find(val => val.id == textureId && val.location.uri.includes('item_texture')))
if (!diagnoser.context.getCache().resourcePacks.itemTextures.find(val => val.id == textureId))
diagnoser.add(textureId,
`Texture reference "${textureId}" was not defined in item_texture.json`,
DiagnosticSeverity.error,
Expand Down
2 changes: 1 addition & 1 deletion src/Lib/Diagnostics/ResourcePack/Block/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function Diagnose(diagnoser: DocumentDiagnosticsBuilder): void {
}

function hasDefinition(block: string, value: string, rp: ResourcePackCollection, diagnoser: DiagnosticsBuilder): void {
if (rp.textures.has(value)) return;
if (rp.terrainTextures.has(value)) return;

diagnoser.add(
`${block}/${value}`,
Expand Down

0 comments on commit dedfb11

Please sign in to comment.