Skip to content

Advanced Digitizer

Advanced digitizer block
MULTI-STORAGE PERIPHERAL

The advanced digitizer moves items, fluids, and energy between attached storage and durable digital identifiers.

Peripheral type
advanced_digitizer
Storage
Items, fluids, energy
Failure style
Recoverable result pairs

The advanced digitizer can extract from its internal inventory with source self, or from an attached inventory/item storage by peripheral name. The source defaults to self.

Mode matters: an identifier belongs to exactly one of item, fluid, or energy. Always use the same mode when inspecting, refreshing, or restoring it.

Item filters may be:

  • A one-based slot number. This requires slotted storage.
  • A namespaced item string such as minecraft:oak_log.
  • A query table using fields such as name, displayName, tag, nbt, and, or, not, or none.
  • nil/null, which accepts any item.

Digitize and accumulate

const chest = peripheral.find("minecraft:chest");
assert(chest != null, "chest not attached");
const chestName = peripheral.getName(chest);

const [id, createError] = digitizer.digitize(
  "item", chestName, "minecraft:oak_log", 32
);
if (id == null) error(createError, 0);

const [sameID, mergeError] = digitizer.digitize(
  "item", chestName, { tag: "minecraft:logs" }, 32, id
);
if (sameID == null) error(mergeError, 0);
local chest = peripheral.find("minecraft:chest")
assert(chest, "chest not attached")
local chestName = peripheral.getName(chest)

local id, createErr = digitizer.digitize(
  "item", chestName, "minecraft:oak_log", 32
)
if not id then error(createErr, 0) end

local sameID, mergeErr = digitizer.digitize(
  "item", chestName, { tag = "minecraft:logs" }, 32, id
)
if not sameID then error(mergeErr, 0) end

The optional destination is an existing binary digital ID, not a peripheral name. A merge succeeds only when the extracted stack can stack with the stored item. It refreshes the destination and returns the same ID.

An explicit limit must be from 1 through itemStackLimit / 2. When merging without a limit, that half-limit is the default per call, further reduced by remaining room. Accumulation cannot exceed itemStackLimit. A new ID created without a limit asks the source for all matching available content; do not assume the configured accumulation limit is an implicit cap for that call.

Rematerialize

const [moved, moveError] = digitizer.rematerialize("item", id, 64, chestName);
if (moved == null) error(moveError, 0);
print(`Moved ${moved}`);
local moved, moveErr = digitizer.rematerialize("item", id, 64, chestName)
if not moved then error(moveErr, 0) end
print("Moved " .. moved)

Omitting destination rematerializes items into self. Omitting limit requests all stored content. Success reports the amount actually inserted. Destinations that accept no content return nil, error without consuming the ID; a peripheral with the wrong storage API throws instead.

Peripheral methods

The reference below is generated from the published TypeScript interface.

digitize

Overload 1

digitize(mode: "item", source?: string | null, filter?: number | string | LuaTable | null, limit?: number | null, destination?: string | null): LuaMultiReturn<[null, string] | [string, null]>

Digitizes items from the internal inventory or an attached item storage.

Parameter Type Description
mode "item" The item storage mode.
source? string \| null \| undefined Peripheral name to extract from, or self. Defaults to self.
filter? string \| number \| LuaTable<AnyNotNil, any> \| null \| undefined One-based slot, item name, or item query table. Defaults to any item.
limit? number \| null \| undefined Optional amount from 1 through half of itemStackLimit.
destination? string \| null \| undefined Existing item identifier to merge into; omit to create a new identifier.

Returns: On success, [id, null]; for an operational failure, [null, message].

Throws: A Lua error for an invalid mode, filter, limit, source, or incompatible storage.

Overload 2

digitize(mode: "fluid" | "energy", source?: string | null, filter?: string | null, limit?: number | null, destination?: string | null): LuaMultiReturn<[null, string] | [string, null]>

Digitizes fluid or energy from an attached storage peripheral.

Parameter Type Description
mode "fluid" \| "energy" The fluid or energy storage mode.
source? string \| null \| undefined Attached peripheral name. The default self is unsupported for these modes.
filter? string \| null \| undefined Fluid name or energy unit; omit to accept the first available content.
limit? number \| null \| undefined Optional mB or energy-unit amount from 1 through half of the mode's configured stack limit.
destination? string \| null \| undefined Existing same-mode identifier to merge into; omit to create a new identifier.

Returns: On success, [id, null]; for an operational failure, [null, message].

Throws: A Lua error for an invalid mode, limit, peripheral, storage type, or use of self.

rematerialize

rematerialize(mode: "item" | "fluid" | "energy", id: string, limit?: number | null, destination?: string | null): LuaMultiReturn<[null, string] | [number, null]>

Rematerializes items, fluid, or energy into a destination storage.

Parameter Type Description
mode "item" \| "fluid" \| "energy" Storage mode associated with id.
id string Opaque binary identifier.
limit? number \| null \| undefined Optional amount from 1 through half of the mode's configured stack limit; defaults to all stored content.
destination? string \| null \| undefined Peripheral name to insert into, or self for items. Defaults to self.

Returns: On success, [amount, null]; for an operational failure, [null, message].

Throws: A Lua error for invalid arguments, inaccessible or incompatible storage, or fluid/energy use of self.

refresh

refresh(mode: "item" | "fluid" | "energy", id: string): boolean

Refreshes an identifier's decay deadline.

Parameter Type Description
mode "item" \| "fluid" \| "energy" Storage mode associated with id.
id string Opaque binary identifier.

Returns: true when refreshed, or false when the identifier is missing or decayed.

Throws: A Lua error if mode is unsupported.

get

Overload 1

get(mode: "item", id: string): ItemIDInfo | null

Reads an item identifier.

Parameter Type Description
mode "item" The item storage mode.
id string Opaque binary item identifier.

Returns: Current metadata, or null when the identifier is missing, exhausted, or decayed.

Throws: A Lua error if mode is unsupported.

Overload 2

get(mode: "fluid", id: string): FluidIDInfo | null

Reads a fluid identifier.

Parameter Type Description
mode "fluid" The fluid storage mode.
id string Opaque binary fluid identifier.

Returns: Current metadata, or null when the identifier is missing, exhausted, or decayed.

Throws: A Lua error if mode is unsupported.

Overload 3

get(mode: "energy", id: string): EnergyIDInfo | null

Reads an energy identifier.

Parameter Type Description
mode "energy" The energy storage mode.
id string Opaque binary energy identifier.

Returns: Current metadata, or null when the identifier is missing, exhausted, or decayed.

Throws: A Lua error if mode is unsupported.

pushItems

Inherited from InventoryAPI.

pushItems(toName: string, fromSlot: number, limit?: number, toSlot?: number): number
Parameter Type Description
toName string
fromSlot number
limit? number \| undefined
toSlot? number \| undefined

pullItems

Inherited from InventoryAPI.

pullItems(fromName: string, fromSlot: number, limit?: number, toSlot?: number): number
Parameter Type Description
fromName string
fromSlot number
limit? number \| undefined
toSlot? number \| undefined

size

Inherited from InventoryViewAPI.

size(): number

list

Inherited from InventoryViewAPI.

list(): LuaTable<number, ShortItemDetail>

getItemDetail

Inherited from InventoryViewAPI.

getItemDetail(slot: number): ExtendedItemDetail
Parameter Type Description
slot number

getItemLimit

Inherited from InventoryViewAPI.

getItemLimit(slot: number): number
Parameter Type Description
slot number

getConfiguration

Inherited from ConfigurationAPI.

getConfiguration(): AdvancedDigitizerConfiguration

View TypeScript source