shrink zero-matter dust stack on split (even if it will never go truly empty)
This commit is contained in:
parent
45084e8fe0
commit
b80fa51fbc
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user