Skip to content

Commit

Permalink
Add check for spawn_egg.texture (#323)
Browse files Browse the repository at this point in the history
* Add check for spawn_egg.texture

* Fix error
  • Loading branch information
Xterionix authored Feb 10, 2025
1 parent 41eb53c commit e2bd38c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Lib/Diagnostics/ResourcePack/Entity/entry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Internal, ResourcePack } from "bc-minecraft-bedrock-project";
import { DocumentDiagnosticsBuilder } from "../../../Types";
import { DiagnosticSeverity, DocumentDiagnosticsBuilder } from "../../../Types";
import { Json } from "../../Json/Json";
import { animation_controller_diagnose_implementation } from "../Animation Controllers/diagnostics";
import { animation_or_controller_diagnose_implementation } from "../anim or controller";
Expand Down Expand Up @@ -96,6 +96,16 @@ export function Diagnose(diagnoser: DocumentDiagnosticsBuilder): void {
resourcepack_particle_diagnose(part_id, diagnoser)
);

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
const textureId = description['spawn_egg']?.['texture']

if (typeof textureId == 'string' && !diagnoser.context.getCache().resourcePacks.itemTextures.find(val => val.id == textureId))
diagnoser.add(`description/spawn_egg/${textureId}`,
`Texture reference "${textureId}" was not defined in item_texture.json`,
DiagnosticSeverity.error,
'behaviorpack.item.components.texture_not_found')

//Get pack
const pack = diagnoser.context.getCache().resourcePacks.get(diagnoser.document.uri);
if (pack === undefined) return;
Expand Down

0 comments on commit e2bd38c

Please sign in to comment.