Fix (dis)chargeable handler filters not allowing to extract invalid items

This commit is contained in:
DBotThePony 2025-03-07 10:14:06 +07:00
parent f011c1a912
commit bbf4e752e7
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -93,7 +93,7 @@ interface HandlerFilter {
}
override fun canExtract(slot: Int, amount: Int, stack: ItemStack): Boolean {
return stack.getCapability(Capabilities.EnergyStorage.ITEM)?.let { !it.canExtract() || it.extractEnergy(Int.MAX_VALUE, true) <= 0 } ?: false
return stack.getCapability(Capabilities.EnergyStorage.ITEM)?.let { !it.canExtract() || it.extractEnergy(Int.MAX_VALUE, true) <= 0 } ?: true
}
}
@ -103,7 +103,7 @@ interface HandlerFilter {
}
override fun canExtract(slot: Int, amount: Int, stack: ItemStack): Boolean {
return stack.getCapability(Capabilities.EnergyStorage.ITEM)?.let { !it.canReceive() || it.receiveEnergy(Int.MAX_VALUE, true) <= 0 } ?: false
return stack.getCapability(Capabilities.EnergyStorage.ITEM)?.let { !it.canReceive() || it.receiveEnergy(Int.MAX_VALUE, true) <= 0 } ?: true
}
}