From b4d53df95671ad3050e4350aaecc9420d3cc6a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E8=91=89=20Scarlet?= <93977077+mukjepscarlet@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:45:10 +0800 Subject: [PATCH] fix(ChestAura): outdated BlockState --- .../player/cheststealer/features/FeatureChestAura.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/cheststealer/features/FeatureChestAura.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/cheststealer/features/FeatureChestAura.kt index 5ecb608ed1f..114c2ef34c6 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/cheststealer/features/FeatureChestAura.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/cheststealer/features/FeatureChestAura.kt @@ -153,7 +153,6 @@ object FeatureChestAura : ToggleableConfigurable(ModuleChestStealer, "Aura", tru } val targetBlockPos = currentTargetBlock ?: return@tickHandler - val targetState = targetBlockPos.getState() ?: return@tickHandler val currentPlayerRotation = RotationManager.serverRotation // Trace a ray from the player to the target block position @@ -161,7 +160,7 @@ object FeatureChestAura : ToggleableConfigurable(ModuleChestStealer, "Aura", tru interactionRange.toDouble(), currentPlayerRotation, targetBlockPos, - targetState + targetBlockPos.getState() ?: return@tickHandler ) // Verify if the block is hit and is the correct target @@ -192,7 +191,7 @@ object FeatureChestAura : ToggleableConfigurable(ModuleChestStealer, "Aura", tru } } else { interactedBlocksSet.add(targetBlockPos) - targetBlockPos.recordAnotherChestPart(targetState) + targetBlockPos.recordAnotherChestPart(targetBlockPos.getState()) currentTargetBlock = null wasInteractionSuccessful = true @@ -203,7 +202,7 @@ object FeatureChestAura : ToggleableConfigurable(ModuleChestStealer, "Aura", tru // Update interacted block set and reset target if successful or exceeded retries if (wasInteractionSuccessful || interactionAttempts >= AwaitContainerSettings.maxInteractionRetries) { interactedBlocksSet.add(targetBlockPos) - targetBlockPos.recordAnotherChestPart(targetState) + targetBlockPos.recordAnotherChestPart(targetBlockPos.getState()) currentTargetBlock = null } else { interactionAttempts++ @@ -211,8 +210,8 @@ object FeatureChestAura : ToggleableConfigurable(ModuleChestStealer, "Aura", tru } } - private fun BlockPos.recordAnotherChestPart(state: BlockState) { - if (state.block !is ChestBlock) { + private fun BlockPos.recordAnotherChestPart(state: BlockState?) { + if (state?.block !is ChestBlock) { return }