|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IComputerAccess
The interface passed to peripherals by computers or turtles, providing methods that they can call. This should not be implemented by your classes. Do not interact with computers except via this interface.
Method Summary | |
---|---|
int |
createNewSaveDir(java.lang.String subPath)
Creates a new numbered directory in a subPath of the users game save, and return that number. |
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. This is the same number obtained by calling os.getComputerID() or running the "id" program from lua, and is guarunteed unique. |
java.lang.String |
mountFixedDir(java.lang.String desiredLocation,
java.lang.String path,
boolean readOnly,
long spaceLimit)
Mounts a directory into the computers file system, from a real directory in the Minecraft install folder. For example: mountFixedDir( "stuff", "mods/mymod/lua/stuff", true ), will mount the "lua/stuff" folder from your mod's directory into the computers filesystem at the location "stuff", with readonly permission, giving the computer access to those files. When a directory is mounted, it will appear in the computers file system, and the user will be able to use file operation to read from and write to the directory (unless readOnly, then only writes will be allowed). mountFixedDir can also be used to mount files, for example: mountFixedDir( "rom/apis/myapi", "mods/mymod/lua/myapi.lua", true ) can be used to have the peripheral install an API onto the computer it attaches to. |
java.lang.String |
mountSaveDir(java.lang.String desiredLocation,
java.lang.String subPath,
int id,
boolean readOnly,
long spaceLimit)
Mounts a directory into the computers file system, from a real directory a subPath of the users game save, with a numerical name. |
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 mountSaveDir or mountFixedDir. When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be able to access it. |
Method Detail |
---|
int createNewSaveDir(java.lang.String subPath)
subPath
- A relative file path from the users world save, where the directory should be located.
mountSaveDir(String, String, int, boolean, long)
java.lang.String mountSaveDir(java.lang.String desiredLocation, java.lang.String subPath, int id, boolean readOnly, long spaceLimit)
desiredLocation
- The desired location in the computers file system where you would like the directory to appear.
If this location already exists, a number will be appended until a free name is found, and the
actual location will be returned. eg: "cdrom" can become "cdrom2" if two peripherals attempt to
mount "cdrom", or a "cdrom" folder already exists.subPath
- The real relative file path from the users world save, where the directory to mount can be located.id
- The numerical name of the folder to mount from the subPath: ex: mountSaveDir( "cdrom", "computer/cdrom", 7 )
will mount the directory "computer/cdrom/7". Use createNewSaveDir to obtain a unique directory id.readOnly
- Whether the computer will be disallowed from making changes to the mounted directory and modifing or creating files therin.spaceLimit
- The size limit of the mount, in bytes. Specify 0 to have unlimited capacity.
createNewSaveDir(String)
,
mountFixedDir(String, String, boolean, long)
,
unmount(String)
java.lang.String mountFixedDir(java.lang.String desiredLocation, java.lang.String path, boolean readOnly, long spaceLimit)
desiredLocation
- The desired location in the computers file system where you would like the directory to appear.
If this location already exists, a number will be appended until a free name is found, and the
actual location will be returned. eg: "cdrom" can become "cdrom2" if two peripherals attempt to
mount "cdrom", or a "cdrom" folder already exists.subPath
- The real relative file path from the minecraft install root, where the directory to mount can be located.readOnly
- Whether the computer will be disallowed from making changes to the mounted directory and modifing or creating files therin.spaceLimit
- The size limit of the mount, in bytes. Specify 0 to have unlimited capacity.
mountSaveDir(String, String, int, boolean, long)
,
unmount(String)
void unmount(java.lang.String location)
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 mountFixedDir() or mountSaveDir(), as
indicated by their return value.mountSaveDir(String, String, int, boolean, long)
,
mountFixedDir(String, String, boolean, long)
int getID()
void queueEvent(java.lang.String event, java.lang.Object[] arguments)
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().IPeripheral.callMethod(dan200.computer.api.IComputerAccess, int, java.lang.Object[])
java.lang.String getAttachmentName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |