diff --git a/src/main/scala/li/cil/oc/server/component/UpgradeTankController.scala b/src/main/scala/li/cil/oc/server/component/UpgradeTankController.scala index e94669142..73e35b58b 100644 --- a/src/main/scala/li/cil/oc/server/component/UpgradeTankController.scala +++ b/src/main/scala/li/cil/oc/server/component/UpgradeTankController.scala @@ -57,9 +57,9 @@ object UpgradeTankController { override def inventory = host.dynamicInventory - override def selectedSlot = host.selectedSlot + override def selectedSlot = host.selectedSlot - host.actualSlot(0) - override def selectedSlot_=(value: Int) = host.selectedSlot = value + override def selectedSlot_=(value: Int) = host.selectedSlot = host.actualSlot(value) override def tank = host.tank diff --git a/src/main/scala/li/cil/oc/server/component/traits/TankInventoryControl.scala b/src/main/scala/li/cil/oc/server/component/traits/TankInventoryControl.scala index 1edbe1b78..993243f9a 100644 --- a/src/main/scala/li/cil/oc/server/component/traits/TankInventoryControl.scala +++ b/src/main/scala/li/cil/oc/server/component/traits/TankInventoryControl.scala @@ -55,7 +55,7 @@ trait TankInventoryControl extends WorldAware with InventoryAware with TankAware if (container.stackSize > 0) { InventoryUtils.spawnStackInWorld(position, container) } - result(true) + result(true, contents.amount) } } else stack.getItem match { @@ -64,7 +64,7 @@ trait TankInventoryControl extends WorldAware with InventoryAware with TankAware val transferred = into.fill(drained, true) if (transferred > 0) { from.drain(stack, transferred, true) - result(true) + result(true, transferred) } else result(Unit, "incompatible or no fluid") case _ => result(Unit, "item is empty or not a fluid container") @@ -88,13 +88,14 @@ trait TankInventoryControl extends WorldAware with InventoryAware with TankAware result(Unit, "tank is empty") } else { - from.drain(FluidContainerRegistry.getFluidForFilledItem(filled).amount, true) + val amount = FluidContainerRegistry.getFluidForFilledItem(filled).amount + from.drain(amount, true) inventory.decrStackSize(selectedSlot, 1) InventoryUtils.insertIntoInventory(filled, inventory, slots = Option(insertionSlots)) if (filled.stackSize > 0) { InventoryUtils.spawnStackInWorld(position, filled) } - result(true) + result(true, amount) } } else stack.getItem match { @@ -103,7 +104,7 @@ trait TankInventoryControl extends WorldAware with InventoryAware with TankAware val transferred = into.fill(stack, drained, true) if (transferred > 0) { from.drain(transferred, true) - result(true) + result(true, transferred) } else result(Unit, "incompatible or no fluid") case _ => result(Unit, "item is full or not a fluid container") diff --git a/src/main/scala/li/cil/oc/server/component/traits/TankWorldControl.scala b/src/main/scala/li/cil/oc/server/component/traits/TankWorldControl.scala index ddc6c7e97..9c9b0825f 100644 --- a/src/main/scala/li/cil/oc/server/component/traits/TankWorldControl.scala +++ b/src/main/scala/li/cil/oc/server/component/traits/TankWorldControl.scala @@ -51,7 +51,7 @@ trait TankWorldControl extends TankAware with WorldAware with SideRestricted { val drained = handler.drain(facing.getOpposite, new FluidStack(stack, amount), true) if ((drained != null && drained.amount > 0) || amount == 0) { tank.fill(drained, true) - result(true) + result(true, drained.amount) } else result(Unit, "incompatible or no fluid") case _ => @@ -67,7 +67,7 @@ trait TankWorldControl extends TankAware with WorldAware with SideRestricted { else if (tank.fill(new FluidStack(fluid, 1000), false) == 1000) { tank.fill(new FluidStack(fluid, 1000), true) world.setBlockToAir(blockPos) - result(true) + result(true, 1000) } else result(Unit, "tank is full") } @@ -95,7 +95,7 @@ trait TankWorldControl extends TankAware with WorldAware with SideRestricted { val filled = handler.fill(facing.getOpposite, new FluidStack(stack, amount), true) if (filled > 0 || amount == 0) { tank.drain(filled, true) - result(true) + result(true, filled) } else result(Unit, "incompatible or no fluid") case _ => @@ -119,7 +119,7 @@ trait TankWorldControl extends TankAware with WorldAware with SideRestricted { world.setBlock(blockPos, fluidBlock) // This fake neighbor update is required to get stills to start flowing. world.notifyBlockOfNeighborChange(blockPos, world.getBlock(position)) - result(true) + result(true, 1000) } } else result(Unit, "no space")