@@ -175,18 +175,12 @@ object PlaceManager : RequestHandler<PlaceRequest>(), PositionBlocking {
175175 false
176176 }
177177
178- private fun SafeContext.placeBlock (request : PlaceRequest , hand : Hand ) =
179- interactBlock(request, request.buildConfig.placeSettings, hand, request.placeContext.result)
180-
181- private fun SafeContext.interactBlock (
182- request : PlaceRequest ,
183- placeConfig : PlaceConfig ,
184- hand : Hand ,
185- hitResult : BlockHitResult
186- ): ActionResult {
178+ private fun SafeContext.placeBlock (request : PlaceRequest , hand : Hand ): ActionResult {
187179 interaction.syncSelectedSlot()
180+ val hitResult = request.placeContext.result
188181 if (! world.worldBorder.contains(hitResult.blockPos)) return ActionResult .FAIL
189- return interactBlockInternal(request, placeConfig, hand, hitResult)
182+ if (gamemode == GameMode .SPECTATOR ) return ActionResult .PASS
183+ return interactBlockInternal(request, request.buildConfig.placeSettings, hand, hitResult)
190184 }
191185
192186 private fun SafeContext.interactBlockInternal (
@@ -195,9 +189,6 @@ object PlaceManager : RequestHandler<PlaceRequest>(), PositionBlocking {
195189 hand : Hand ,
196190 hitResult : BlockHitResult
197191 ): ActionResult {
198- val itemStack = player.getStackInHand(hand)
199- if (gamemode == GameMode .SPECTATOR ) return ActionResult .PASS
200-
201192 val handNotEmpty = player.getStackInHand(hand).isEmpty.not ()
202193 val cantInteract = player.shouldCancelInteraction() && handNotEmpty
203194 if (! cantInteract) {
@@ -214,6 +205,8 @@ object PlaceManager : RequestHandler<PlaceRequest>(), PositionBlocking {
214205// }
215206 }
216207
208+ val itemStack = player.getStackInHand(hand)
209+
217210 if (! itemStack.isEmpty && ! isItemOnCooldown(itemStack.item)) {
218211 val itemUsageContext = ItemUsageContext (player, hand, hitResult)
219212 return if (gamemode.isCreative) {
0 commit comments