public final class FileSystem
extends java.lang.Object
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, li.cil.oc.api.fs.Label, li.cil.oc.api.network.EnvironmentHost, java.lang.String, int)
or its overloads will appear as
filesystem components in the component network. Note that the
component's visibility is set to Neighbors per default. If you wish
to change the file system's visibility (e.g. like the disk drive does) you
must cast the environment's node to Component
and set the visibility to the desired value.
API.fileSystem
may not have been initialized
at that time. Only start calling these methods in the init phase or later.Modifier and Type | Method and Description |
---|---|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
Label label)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
Label label,
EnvironmentHost host,
java.lang.String accessSound)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
Label label,
EnvironmentHost host,
java.lang.String accessSound,
int speed)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
java.lang.String label)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
java.lang.String label,
EnvironmentHost host,
java.lang.String accessSound)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
java.lang.String label,
EnvironmentHost host,
java.lang.String accessSound,
int speed)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static FileSystem |
asReadOnly(FileSystem fileSystem)
Wrap a file system retrieved via one of the from??? methods to
make it read-only.
|
static FileSystem |
fromMemory(long capacity)
Creates a new writable file system that resides in memory.
|
static FileSystem |
fromResource(net.minecraft.util.ResourceLocation location)
Creates a new file system based on a mod-specific resource location where
the namespace refers to the mod and the resource path denotes a
(mandatory) subpath relative to that mod's assets directory.
|
static FileSystem |
fromSaveDirectory(java.lang.String root,
long capacity)
Same as
fromSaveDirectory(String, long, boolean) with the
buffered parameter being true, i.e. |
static FileSystem |
fromSaveDirectory(java.lang.String root,
long capacity,
boolean buffered)
Creates a new writable file system in the save folder.
|
public static FileSystem fromResource(net.minecraft.util.ResourceLocation location)
location
is stored in a JAR file, this will create a read-only
file system based on that JAR file. If location
is stored in the
native file system, this will create a read-only file system from the the
location constructed as described above (relative to the root of the
namespace).
location
- the location where the file system's contents are stored.public static FileSystem fromSaveDirectory(java.lang.String root, long capacity, boolean buffered)
"saves/" + WORLD_NAME + "/opencomputers/" + rootThe first part may differ, in particular for servers.
root
- the name of the file system.capacity
- the amount of space in bytes to allow being used.buffered
- whether data should only be written to disk when saving.public static FileSystem fromSaveDirectory(java.lang.String root, long capacity)
fromSaveDirectory(String, long, boolean)
with the
buffered parameter being true, i.e. will always create a
buffered file system.root
- the name of the file system.capacity
- the amount of space in bytes to allow being used.public static FileSystem fromMemory(long capacity)
capacity
- the capacity of the file system.public static FileSystem asReadOnly(FileSystem fileSystem)
fileSystem
- the file system to wrap.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, EnvironmentHost host, java.lang.String accessSound, int speed)
fileSystem
- the file system to wrap.label
- the label of the file system.host
- the tile entity containing the file system.accessSound
- the name of the sound effect to play when the file
system is accessed. This has to be the fully
qualified resource name, e.g.
opencomputers:floppy_access.speed
- the speed multiplier for this file system.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, java.lang.String label, EnvironmentHost host, java.lang.String accessSound, int speed)
fileSystem
- the file system to wrap.label
- the label of the file system.host
- the tile entity containing the file system.accessSound
- the name of the sound effect to play when the file
system is accessed. This has to be the fully
qualified resource name, e.g.
opencomputers:floppy_access.speed
- the speed multiplier for this file system.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, EnvironmentHost host, java.lang.String accessSound)
fileSystem
- the file system to wrap.label
- the label of the file system.host
- the tile entity containing the file system.accessSound
- the name of the sound effect to play when the file
system is accessed. This has to be the fully
qualified resource name, e.g.
opencomputers:floppy_access.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, java.lang.String label, EnvironmentHost host, java.lang.String accessSound)
fileSystem
- the file system to wrap.label
- the read-only label of the file system.host
- the tile entity containing the file system.accessSound
- the name of the sound effect to play when the file
system is accessed. This has to be the fully
qualified resource name, e.g.
opencomputers:floppy_access.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label)
fileSystem
- the file system to wrap.label
- the label of the file system.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, java.lang.String label)
fileSystem
- the file system to wrap.label
- the read-only label of the file system.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem)
fileSystem
- the file system to wrap.