Skip to content

Commit 56a2abf

Browse files
committed
decrement item stack even if awaiting before client placement
1 parent 2427e33 commit 56a2abf

File tree

1 file changed

+3
-2
lines changed
  • common/src/main/kotlin/com/lambda/interaction/request/placing

1 file changed

+3
-2
lines changed

common/src/main/kotlin/com/lambda/interaction/request/placing/PlaceManager.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ object PlaceManager : RequestHandler<PlaceRequest>(
295295
}
296296
}
297297

298+
val itemStack = itemPlacementContext.stack
299+
if (!player.abilities.creativeMode) itemStack.decrement(1)
300+
298301
if (placeConfig.placeConfirmationMode == PlaceConfig.PlaceConfirmationMode.AwaitThenPlace)
299302
return ActionResult.success(world.isClient)
300303

@@ -304,7 +307,6 @@ object PlaceManager : RequestHandler<PlaceRequest>(
304307
if (!item.place(itemPlacementContext, blockState)) return ActionResult.FAIL
305308

306309
val blockPos = itemPlacementContext.blockPos
307-
val itemStack = itemPlacementContext.stack
308310
var hitState = world.getBlockState(blockPos)
309311
if (hitState.isOf(blockState.block)) {
310312
hitState = item.placeFromNbt(blockPos, world, itemStack, hitState)
@@ -313,7 +315,6 @@ object PlaceManager : RequestHandler<PlaceRequest>(
313315
}
314316

315317
if (placeConfig.sounds) placeSound(item, hitState, blockPos)
316-
if (!player.abilities.creativeMode) itemStack.decrement(1)
317318

318319
if (placeConfig.placeConfirmationMode == PlaceConfig.PlaceConfirmationMode.None) {
319320
request.onPlace?.invoke(placeContext.blockPos)

0 commit comments

Comments
 (0)