diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt index 87cb9b192..4a6a52d04 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt @@ -87,15 +87,17 @@ class MatterDustItem : Item(Properties().stacksTo(64)), IMatterItem { return super.overrideStackedOnOther(pStack, pSlot, pAction, pPlayer) if (pAction == ClickAction.SECONDARY && pSlot.allowModification(pPlayer)) { - val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true - if (!pSlot.hasItem()) { + val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true + val halfStack = pStack.copyWithCount(1) - matter(halfStack, -addMatterValue(pStack, -matterHalf, pPlayer.level.isClientSide())) - pSlot.set(halfStack) + if (getMatterValue(pStack)?.matter!! <= Decimal.ZERO) { + pStack.shrink(1) + } + return true } } @@ -115,13 +117,11 @@ class MatterDustItem : Item(Properties().stacksTo(64)), IMatterItem { return super.overrideStackedOnOther(pStack, pSlot, pAction, pPlayer) if (pAction == ClickAction.SECONDARY && pSlot.allowModification(pPlayer)) { - val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true - if (pOther.isEmpty) { + val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true + val halfStack = pStack.copyWithCount(1) - matter(halfStack, -addMatterValue(pStack, -matterHalf, pPlayer.level.isClientSide())) - pAccess.set(halfStack) return true