From 307d560e1be39fd513d4216500848bfec69cf6a8 Mon Sep 17 00:00:00 2001 From: DaanV2 Date: Thu, 1 Feb 2024 18:15:59 +0100 Subject: [PATCH] Stopping movement.glide detection --- .../Entity/components/dependencies.ts | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/Lib/Diagnostics/BehaviorPack/Entity/components/dependencies.ts b/src/Lib/Diagnostics/BehaviorPack/Entity/components/dependencies.ts index 77c26f33..3ccca722 100644 --- a/src/Lib/Diagnostics/BehaviorPack/Entity/components/dependencies.ts +++ b/src/Lib/Diagnostics/BehaviorPack/Entity/components/dependencies.ts @@ -1,6 +1,6 @@ import { components_dependencies, Context, DependedMap } from "../../../../Utility/components"; import { DiagnosticsBuilder, DiagnosticSeverity } from "../../../../Types"; -import { hasPattern } from '../../../../Utility/Checks'; +import { hasPattern } from "../../../../Utility/Checks"; import { Internal } from "bc-minecraft-bedrock-project"; //Map of components that are depended on all other specified components @@ -45,25 +45,32 @@ export function behaviorpack_entity_components_dependencies( } function checkMovements(diagnoser: DiagnosticsBuilder, components: string[]): void { - const hasMovement = hasPattern("minecraft:movement.", components) ? 1 : 0; - const hasNavigation = hasPattern("minecraft:navigation.", components) ? 1 : 0; + const hasMovement = hasPattern("minecraft:movement.", components); + const hasNavigation = hasPattern("minecraft:navigation.", components); - const Count = hasMovement + hasNavigation; + // Check if + if (components.includes("minecraft:movement.glide")) { + return; + } + + if (hasMovement && hasNavigation) { + return; + } - if (Count > 0 && Count != 2) { - if (hasMovement == 0) - diagnoser.add( - "minecraft:movement", - `Missing a movement component such as: 'minecraft:movement.basic'`, - DiagnosticSeverity.error, - "behaviorpack.entity.component.missing" - ); - if (hasNavigation == 0) - diagnoser.add( - "minecraft:movement", - `Missing a movement component such as: 'minecraft:navigation.generic'`, - DiagnosticSeverity.error, - "behaviorpack.entity.component.missing" - ); + if (!hasMovement) { + diagnoser.add( + "minecraft:movement", + `Missing a movement component such as: 'minecraft:movement.basic'`, + DiagnosticSeverity.error, + "behaviorpack.entity.component.missing" + ); + } + if (!hasNavigation) { + diagnoser.add( + "minecraft:movement", + `Missing a movement component such as: 'minecraft:navigation.generic'`, + DiagnosticSeverity.error, + "behaviorpack.entity.component.missing" + ); } }