From fe1ea14f1c122ea3229daae1851c26144843a0af Mon Sep 17 00:00:00 2001 From: jimchen5209 Date: Sat, 17 Aug 2024 21:59:16 +0800 Subject: [PATCH 1/3] fix: player should be able to harvest when hands are empty - whenever player is sneaking --- src/main/kotlin/one/oktw/galaxy/player/Harvest.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/one/oktw/galaxy/player/Harvest.kt b/src/main/kotlin/one/oktw/galaxy/player/Harvest.kt index c2e79917b..73fd6e547 100644 --- a/src/main/kotlin/one/oktw/galaxy/player/Harvest.kt +++ b/src/main/kotlin/one/oktw/galaxy/player/Harvest.kt @@ -1,6 +1,6 @@ /* * OKTW Galaxy Project - * Copyright (C) 2018-2023 + * Copyright (C) 2018-2024 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published @@ -44,7 +44,11 @@ class Harvest { val blockPos = event.packet.blockHitResult.blockPos val blockState = world.getBlockState(blockPos) - if (event.packet.hand == Hand.MAIN_HAND && !player.isSneaking && isMature(world, blockPos, blockState)) { + if ( + event.packet.hand == Hand.MAIN_HAND && + (!player.isSneaking || (player.mainHandStack.isEmpty && player.offHandStack.isEmpty)) && + isMature(world, blockPos, blockState) + ) { event.cancel = true val block = blockState.block val ageProperties = when (block) { From eabf00de142a3b27dd29c66753363b9d273ee314 Mon Sep 17 00:00:00 2001 From: jimchen5209 Date: Sat, 17 Aug 2024 22:36:54 +0800 Subject: [PATCH 2/3] fix: hand not swing when spinning custom block --- src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt b/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt index 634b64b84..eb7ccc939 100644 --- a/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt +++ b/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt @@ -1,6 +1,6 @@ /* * OKTW Galaxy Project - * Copyright (C) 2018-2023 + * Copyright (C) 2018-2024 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published @@ -79,6 +79,7 @@ class Wrench { startDirection[player] = blockPos to direction blockEntity.facing = if (next == -1 || next > allowedFacing.lastIndex) allowedFacing.first() else allowedFacing[next] + return true } // Check destructible From bd3f1bdb0568b582535a4103f6708320e46495a6 Mon Sep 17 00:00:00 2001 From: jimchen5209 Date: Sat, 17 Aug 2024 23:32:35 +0800 Subject: [PATCH 3/3] fix: workaround disable state update for bell --- src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt b/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt index eb7ccc939..f09f6dce2 100644 --- a/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt +++ b/src/main/kotlin/one/oktw/galaxy/item/event/Wrench.kt @@ -214,7 +214,8 @@ class Wrench { world.setBlockState(blockPos, newState) world.updateNeighbor(newState, blockPos, newState.block, blockPos, true) - Block.postProcessState(newState, world, blockPos).let { if (!it.isAir) world.setBlockState(blockPos, it, 2) } + // Workaround disable state update for bell + Block.postProcessState(newState, world, blockPos).let { if (!it.isAir && it.block != BELL) world.setBlockState(blockPos, it, 2) } return true }