From 0a8c23f73f983233449ffd70a6f84f8a5c8bbe50 Mon Sep 17 00:00:00 2001 From: ForestOfLight Date: Thu, 19 Sep 2024 11:44:26 -0700 Subject: [PATCH] error handling for short fuse times --- Canopy [BP]/scripts/src/rules/tntPrimeMaxMomentum.js | 1 + Canopy [BP]/scripts/src/rules/tntPrimeNoMomentum.js | 1 + 2 files changed, 2 insertions(+) diff --git a/Canopy [BP]/scripts/src/rules/tntPrimeMaxMomentum.js b/Canopy [BP]/scripts/src/rules/tntPrimeMaxMomentum.js index c8e112a..10a7d22 100644 --- a/Canopy [BP]/scripts/src/rules/tntPrimeMaxMomentum.js +++ b/Canopy [BP]/scripts/src/rules/tntPrimeMaxMomentum.js @@ -15,6 +15,7 @@ world.afterEvents.entitySpawn.subscribe(async (event) => { const entity = event.entity; if (await Rule.getValue('dupeTnt')) { system.runTimeout(() => { + if (!entity.isValid()) return; correctErrorAndNegateXZVelocity(entity); applyHardcodedImpulse(entity); }, 1); diff --git a/Canopy [BP]/scripts/src/rules/tntPrimeNoMomentum.js b/Canopy [BP]/scripts/src/rules/tntPrimeNoMomentum.js index fa52fa0..52ac5e3 100644 --- a/Canopy [BP]/scripts/src/rules/tntPrimeNoMomentum.js +++ b/Canopy [BP]/scripts/src/rules/tntPrimeNoMomentum.js @@ -14,6 +14,7 @@ world.afterEvents.entitySpawn.subscribe(async (event) => { const entity = event.entity; if (await Rule.getValue('dupeTnt')) { system.runTimeout(() => { + if (!entity.isValid()) return; correctErrorAndNegateXZVelocity(entity); }, 1); } else {