Skip to content

Commit

Permalink
fix: player should be able to harvest when hands are empty
Browse files Browse the repository at this point in the history
- whenever player is sneaking
  • Loading branch information
jimchen5209 committed Aug 17, 2024
1 parent 439e68f commit fe1ea14
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/kotlin/one/oktw/galaxy/player/Harvest.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fe1ea14

Please sign in to comment.