Skip to content

Commit d1ffc5d

Browse files
committed
Fix some bugs in the Transposer's transferFluid method
* Convert the source tank index from 1-based to 0-based when parsing the argument * Use `count` as an upper limit for the amount to transfer
1 parent 274990f commit d1ffc5d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/scala/li/cil/oc/server/component/traits/InventoryTransfer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ trait InventoryTransfer extends traits.WorldAware with traits.SideRestricted {
4848
val sinkSide = checkSideForAction(args, 1)
4949
val sinkPos = position.offset(sinkSide)
5050
val count = args.optFluidCount(2)
51-
val sourceTank = args.optInteger(3, -1)
51+
val sourceTank = args.optInteger(3, -1) - 1
5252

5353
onTransferContents() match {
5454
case Some(reason) =>

src/main/scala/li/cil/oc/util/FluidUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ object FluidUtils {
6363
stackToDrain = tankProperties(sourceTank).getContents
6464
if (stackToDrain != null) {
6565
stackToDrain = stackToDrain.copy()
66-
stackToDrain.amount = math.max(stackToDrain.amount, limit)
66+
stackToDrain.amount = math.min(stackToDrain.amount, limit)
6767
}
6868
}
6969
}

0 commit comments

Comments
 (0)