class InventoryFilterMixin(name: str, similar_entities: list[str], **kwargs: dict)

Allows an Entity to set inventory filters. Only used on CargoWagon.

set_inventory_filter(index: int, item: str) None

Sets the item filter at a particular index. If item is set to None, the item filter at that location is removed.

  • index – The index of the filter to set.

  • item – The string name of the item to filter.

  • TypeError – If index is not an int or if item is neither a str nor None.

  • InvalidItemError – If item is not a valid item name.

  • IndexError – If index lies outside the range [0, inventory_size).

set_inventory_filters(filters: list) None

Sets all the inventory filters of the Entity.

filters can be either of the following formats:

[{"index": int, "signal": {"name": item_name_1, "type": "item"}}, ...]
# Or
[{"index": int, "signal": item_name_1}, ...]
# Or
[item_name_1, item_name_2, ...]

With the second format, the index of each item is set to it’s position in the list. filters can also be None, which will wipe all inventory filters that the Entity has.


filters – The inventory filters to give the Entity.

  • DataFormatError – If the filters argument does not match the specification above.

  • InvalidItemError – If the item name of one of the entries is not valid.

  • IndexError – If the index of one of the entries lies outside the range [0, inventory_size).

property bar: int

The limiting bar of the inventory. Used to prevent a the final-most slots in the inventory from accepting items.

Raises IndexWarning if the set value exceeds the Entity’s inventory_size attribute.


Gets the bar location of the inventory, or None if not set.


Sets the bar location of the inventory. Removes the entry from the inventory object.



  • TypeError – If set to anything other than an int or None.

  • IndexError – If the set value lies outside of the range [0, 65536).

property inventory: dict

Inventory filter object. Contains the filter information under the "filters" key and the inventory limiting bar under the "bar" key.

This attribute is in the following format:

    "bar": int,
    "filters": [
        {"index": int, "signal": {"name": str, "type": str}},

Gets the value of the Entity’s inventory object.


Sets the value of the Entity’s inventory object. Defaults to an empty dict if set to None.


See draftsman.signatures.INVENTORY_FILTER.


DataFormatError – If the set value differs from the INVENTORY_FILTER specification.

property inventory_size: int

The number of inventory slots that this Entity has. Equivalent to the "inventory_size" key in Factorio’s data.raw. Not exported; read only.