public final class Machine
extends java.lang.Object
Architectures,
which are implementations of specific languages (e.g. assembler). The built-
in ones are available as static fields in this class.
Note that registration of architectures is optional and only intended as a
convenience feature to provide mods with a way to iterate available
architectures using architectures(). Also note that any architecture
passed to create(li.cil.oc.api.machine.Owner, Class) that has not
yet been registered will automatically be registered.
Note that these methods should not be called in the pre-init phase,
since the instance may not have been initialized at that time. Only
start calling these methods in the init phase or later.| Modifier and Type | Field and Description |
|---|---|
static MachineAPI |
instance |
static java.lang.Class<? extends Architecture> |
LuaArchitecture
The built-in Lua architecture.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
add(java.lang.Class<? extends Architecture> architecture)
Register an architecture that can be used to create new machines.
|
static java.lang.Iterable<java.lang.Class<? extends Architecture>> |
architectures()
A list of all registered architectures.
|
static Machine |
create(Owner owner)
Creates a new machine using the default architecture (Lua).
|
static Machine |
create(Owner owner,
java.lang.Class<? extends Architecture> architecture)
Creates a new machine using the specified architecture.
|
public static MachineAPI instance
public static java.lang.Class<? extends Architecture> LuaArchitecture
public static void add(java.lang.Class<? extends Architecture> architecture)
architectures() to be useful.architecture - the architecture to register.public static java.lang.Iterable<java.lang.Class<? extends Architecture>> architectures()
create(li.cil.oc.api.machine.Owner, Class) with a not yet
registered architecture. What this means is that unless a mod providing
a custom architecture also registers it, you may not see it in this list
until it also created a new machine using that architecture.public static Machine create(Owner owner, java.lang.Class<? extends Architecture> architecture)
owner - the owner object of the machine, providing context.architecture - the architecture to use for running code on the machine.java.lang.IllegalArgumentException - if the specified architecture is invalid.public static Machine create(Owner owner)
owner - the owner object of the machine, providing context.