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.
|
static interface |
Architecture.NoMemoryRequirements
Architectures flagged with this annotation can potentially run without
any additional memory installed in the computer.
|
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 |
loadData(net.minecraft.nbt.CompoundNBT nbt)
Restores the state of this architecture as previously saved in
saveData(CompoundNBT) . |
void |
onConnect()
Called when the owning machine was connected to the component network.
|
void |
onSignal()
Called when a new signal is queued in the hosting
Machine . |
boolean |
recomputeMemory(java.lang.Iterable<net.minecraft.item.ItemStack> components)
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 |
saveData(net.minecraft.nbt.CompoundNBT nbt)
Saves the architecture for later restoration, e.g.
|
boolean isInitialized()
boolean recomputeMemory(java.lang.Iterable<net.minecraft.item.ItemStack> components)
components
- the components to use for computing the total memory.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)
.
ExecutionResult runThreaded(boolean isSynchronizedReturn)
isInitialized()
.
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 onSignal()
Machine
.
runThreaded(boolean)
is called again. However,
if you'd like to react to signals in a more timely manner, you can
react to this while you are in a runThreaded(boolean)
call,
which is what it is intended to be used for.
Context.signal(java.lang.String, java.lang.Object...)
does not require being called from a specific
thread.void onConnect()
initialize()
was called from the machine's load logic
(where it was not yet connected to the network).void loadData(net.minecraft.nbt.CompoundNBT nbt)
saveData(CompoundNBT)
. 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 saveData(net.minecraft.nbt.CompoundNBT nbt)
nbt
- the tag compound to save to.