From 2efbe7be0c3ca9ef1654f0a8a1a54bf231b104b3 Mon Sep 17 00:00:00 2001 From: saschabuehrle Date: Sun, 12 Apr 2026 10:48:32 +0200 Subject: [PATCH] fix: avoid invalid entity errors in fast easy place tick handling --- packs/BP/scripts/options/fastEasyPlace.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packs/BP/scripts/options/fastEasyPlace.js b/packs/BP/scripts/options/fastEasyPlace.js index bf8ccd3..126e8f5 100644 --- a/packs/BP/scripts/options/fastEasyPlace.js +++ b/packs/BP/scripts/options/fastEasyPlace.js @@ -86,6 +86,8 @@ function processEasyPlace(player) { if (!structureBlock) return; const worldBlock = player.dimension.getBlock(structureBlock.location); + if (!worldBlock) + return; if (locationsPlacedLastTick.has(JSON.stringify(worldBlock.location))) return; locationsPlacedLastTick.add(JSON.stringify(worldBlock.location)); @@ -103,10 +105,14 @@ function preventAction(event, player) { } function isHoldingActionItem(player) { - const mainhandItemStack = player.getComponent(EntityComponentTypes.Equippable).getEquipment(EquipmentSlot.Mainhand); - if (!mainhandItemStack) + try { + const mainhandItemStack = player.getComponent(EntityComponentTypes.Equippable).getEquipment(EquipmentSlot.Mainhand); + if (!mainhandItemStack) + return false; + return mainhandItemStack.typeId === ACTION_ITEM; + } catch { return false; - return mainhandItemStack.typeId === ACTION_ITEM; + } } function tryPlaceBlock(player, worldBlock, structureBlock) {