public interface Architecture
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Architecture.Name
Architectures can be annotated with this to provide a nice display name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Called when a machine stopped.
|
boolean |
initialize()
Called when a machine starts up.
|
boolean |
isInitialized()
Used to check if the machine is fully initialized.
|
void |
load(net.minecraft.nbt.NBTTagCompound nbt)
Restores the state of this architecture as previously saved in
save(NBTTagCompound). |
void |
onConnect()
Called when the owning machine was connected to the component network.
|
void |
recomputeMemory()
This is called when the amount of memory in the machine may have changed.
|
void |
runSynchronized()
Performs a synchronized call initialized in a previous call to
runThreaded(boolean). |
ExecutionResult |
runThreaded(boolean isSynchronizedReturn)
Continues execution of the machine.
|
void |
save(net.minecraft.nbt.NBTTagCompound nbt)
Saves the architecture for later restoration, e.g.
|
boolean isInitialized()
void recomputeMemory()
boolean initialize()
onConnect() for additional initialization that
depends on a node network (such as connecting a ROM file system).void close()
void runSynchronized()
runThreaded(boolean).
This method is invoked from the main server thread, meaning it is safe
to interact with the world without having to perform manual
synchronization.
This method is expected to leave the architecture in a state so it is
prepared to next be called with runThreaded(true). For example,
the Lua architecture will leave the results of the synchronized call on
the stack so they can be further processed in the next call to
runThreaded.ExecutionResult runThreaded(boolean isSynchronizedReturn)
isInitialized().
The resumed state is either a return from a synchronized call, when a
synchronized call has been completed (via runSynchronized), or
a normal yield in all other cases (sleep, interrupt, boot, ...).
This is expected to return within a very short time, usually. For example,
in Lua this returns as soon as the state yields, and returns at the latest
when the Settings.timeout is reached (in which case it forces the state
to crash).
This is expected to consume a single signal if one is present and return.
If returning from a synchronized call this should consume no signal.isSynchronizedReturn - whether the architecture is resumed from an
earlier synchronized call. In the case of
Lua this means the results of the call are
now on the stack, for example.void onConnect()
initialize() was called from the machine's load logic
(where it was not yet connected to the network).void load(net.minecraft.nbt.NBTTagCompound nbt)
save(NBTTagCompound). The architecture should be in the same
state it was when it was saved after this, so it can be resumed from
whatever state the owning machine was in when it was saved.nbt - the tag compound to save to.void save(net.minecraft.nbt.NBTTagCompound nbt)
nbt - the tag compound to save to.