public interface IComputerAccess
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttachmentName()
Get a string, unique to the computer, by which the computer refers to this peripheral.
|
int |
getID()
Returns the numerical ID of this computer.
|
java.lang.String |
mount(java.lang.String desiredLocation,
IMount mount)
Mount a mount onto the computer's file system in a read only mode.
|
java.lang.String |
mount(java.lang.String desiredLocation,
IMount mount,
java.lang.String driveName)
Mount a mount onto the computer's file system in a read only mode.
|
java.lang.String |
mountWritable(java.lang.String desiredLocation,
IWritableMount mount)
Mount a mount onto the computer's file system in a writable mode.
|
java.lang.String |
mountWritable(java.lang.String desiredLocation,
IWritableMount mount,
java.lang.String driveName)
Mount a mount onto the computer's file system in a writable mode.
|
void |
queueEvent(java.lang.String event,
java.lang.Object[] arguments)
Causes an event to be raised on this computer, which the computer can respond to by calling
os.pullEvent() . |
void |
unmount(java.lang.String location)
Unmounts a directory previously mounted onto the computers file system by
mount(String, IMount)
or mountWritable(String, IWritableMount) . |
java.lang.String mount(java.lang.String desiredLocation, IMount mount)
desiredLocation
- The location on the computer's file system where you would like the mount to be mounted.mount
- The mount object to mount on the computer.null
if there was already a
file in the desired location. Store this value if you wish to unmount the mount later.java.lang.RuntimeException
- If the peripheral has been detached.ComputerCraftAPI#createSaveDirMount(World, String, long)
,
ComputerCraftAPI#createResourceMount(Class, String, String)
,
mount(String, IMount, String)
,
mountWritable(String, IWritableMount)
,
unmount(String)
,
IMount
java.lang.String mount(java.lang.String desiredLocation, IMount mount, java.lang.String driveName)
desiredLocation
- The location on the computer's file system where you would like the mount to be mounted.mount
- The mount object to mount on the computer.driveName
- A custom name to give for this mount location, as returned by fs.getDrive()
.null
if there was already a
file in the desired location. Store this value if you wish to unmount the mount later.java.lang.RuntimeException
- If the peripheral has been detached.ComputerCraftAPI#createSaveDirMount(World, String, long)
,
ComputerCraftAPI#createResourceMount(Class, String, String)
,
mount(String, IMount)
,
mountWritable(String, IWritableMount)
,
unmount(String)
,
IMount
java.lang.String mountWritable(java.lang.String desiredLocation, IWritableMount mount)
desiredLocation
- The location on the computer's file system where you would like the mount to be mounted.mount
- The mount object to mount on the computer.java.lang.RuntimeException
- If the peripheral has been detached.ComputerCraftAPI#createSaveDirMount(World, String, long)
,
ComputerCraftAPI#createResourceMount(Class, String, String)
,
mount(String, IMount)
,
unmount(String)
,
IMount
java.lang.String mountWritable(java.lang.String desiredLocation, IWritableMount mount, java.lang.String driveName)
desiredLocation
- The location on the computer's file system where you would like the mount to be mounted.mount
- The mount object to mount on the computer.driveName
- A custom name to give for this mount location, as returned by fs.getDrive()
.java.lang.RuntimeException
- If the peripheral has been detached.ComputerCraftAPI#createSaveDirMount(World, String, long)
,
ComputerCraftAPI#createResourceMount(Class, String, String)
,
mount(String, IMount)
,
unmount(String)
,
IMount
void unmount(java.lang.String location)
mount(String, IMount)
or mountWritable(String, IWritableMount)
.
When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be
able to access it. All directories mounted by a mount or mountWritable are automatically unmounted when the
peripheral is attached if they have not been explicitly unmounted.
Note that you cannot unmount another peripheral's mounts.location
- The desired location in the computers file system of the directory to unmount.
This must be the location of a directory previously mounted by mount(String, IMount)
or
mountWritable(String, IWritableMount)
, as indicated by their return value.java.lang.RuntimeException
- If the peripheral has been detached.java.lang.RuntimeException
- If the mount does not exist, or was mounted by another peripheral.mount(String, IMount)
,
mountWritable(String, IWritableMount)
int getID()
os.getComputerID()
or running the "id" program from lua,
and is guaranteed unique. This number will be positive.void queueEvent(java.lang.String event, java.lang.Object[] arguments)
os.pullEvent()
. This can be used to notify the computer when things happen in the world or to
this peripheral.event
- A string identifying the type of event that has occurred, this will be
returned as the first value from os.pullEvent()
. It is recommended that you
you choose a name that is unique, and recognisable as originating from your
peripheral. eg: If your peripheral type is "button", a suitable event would be
"button_pressed".arguments
- In addition to a name, you may pass an array of extra arguments to the event, that will
be supplied as extra return values to os.pullEvent(). Objects in the array will be converted
to lua data types in the same fashion as the return values of IPeripheral.callMethod().
You may supply null
to indicate that no arguments are to be supplied.java.lang.RuntimeException
- If the peripheral has been detached.IPeripheral.callMethod(dan200.computercraft.api.peripheral.IComputerAccess, dan200.computercraft.api.lua.ILuaContext, int, java.lang.Object[])
java.lang.String getAttachmentName()
java.lang.RuntimeException
- If the peripheral has been detached.