public final class ComputerCraftAPI
extends java.lang.Object
Constructor and Description |
---|
ComputerCraftAPI() |
Modifier and Type | Method and Description |
---|---|
static IMount |
createResourceMount(java.lang.Class<?> modClass,
java.lang.String domain,
java.lang.String subPath)
Creates a file system mount to a resource folder, and returns it.
|
static IWritableMount |
createSaveDirMount(World world,
java.lang.String subPath,
long capacity)
Creates a file system mount that maps to a subfolder of the save directory for a given world, and returns it.
|
static int |
createUniqueNumberedSaveDir(World world,
java.lang.String parentSubPath)
Creates a numbered directory in a subfolder of the save directory for a given world, and returns that number.
|
static java.lang.String |
getAPIVersion() |
static int |
getBundledRedstoneOutput(World world,
BlockPos pos,
EnumFacing side)
If there is a Computer or Turtle at a certain position in the world, get it's bundled redstone output.
|
static java.lang.String |
getInstalledVersion() |
static IPacketNetwork |
getWirelessNetwork()
Attempt to get the game-wide wireless network.
|
static boolean |
isInstalled() |
static void |
registerBundledRedstoneProvider(IBundledRedstoneProvider handler)
Registers a bundled redstone handler to provide bundled redstone output for blocks.
|
static void |
registerMediaProvider(IMediaProvider handler)
Registers a media handler to provide
IMedia implementations for Items |
static void |
registerPeripheralProvider(IPeripheralProvider handler)
Registers a peripheral handler to convert blocks into
IPeripheral implementations. |
static void |
registerPermissionProvider(ITurtlePermissionProvider handler)
Registers a permission handler to restrict where turtles can move or build.
|
static void |
registerPocketUpgrade(IPocketUpgrade upgrade) |
static void |
registerTurtleUpgrade(ITurtleUpgrade upgrade)
Registers a new turtle turtle for use in ComputerCraft.
|
public static boolean isInstalled()
public static java.lang.String getInstalledVersion()
public static java.lang.String getAPIVersion()
public static int createUniqueNumberedSaveDir(World world, java.lang.String parentSubPath)
world
- The world for which the save dir should be created. This should be the server side world object.parentSubPath
- The folder path within the save directory where the new directory should be created. eg: "computercraft/disk"createSaveDirMount(World, String, long)
public static IWritableMount createSaveDirMount(World world, java.lang.String subPath, long capacity)
world
- The world for which the save dir can be found. This should be the server side world object.subPath
- The folder path within the save directory that the mount should map to. eg: "computer/disk/42".
Use createUniqueNumberedSaveDir() to create a new numbered folder to use.capacity
- The amount of data that can be stored in the directory before it fills up, in bytes.createUniqueNumberedSaveDir(World, String)
,
IComputerAccess.mount(String, IMount)
,
IComputerAccess.mountWritable(String, IWritableMount)
,
IMount
,
IWritableMount
public static IMount createResourceMount(java.lang.Class<?> modClass, java.lang.String domain, java.lang.String subPath)
modClass
- A class in whose jar to look first for the resources to mount. Using your main mod class is recommended. eg: MyMod.classdomain
- The domain under which to look for resources. eg: "mymod".subPath
- The domain under which to look for resources. eg: "mymod/lua/myfiles".null
if it could be created for some reason. Use IComputerAccess.mount() or
IComputerAccess.mountWritable() to mount this on a Computers' file system.IComputerAccess.mount(String, IMount)
,
IComputerAccess.mountWritable(String, IWritableMount)
,
IMount
public static void registerPeripheralProvider(IPeripheralProvider handler)
IPeripheral
implementations.handler
- The peripheral provider to register.IPeripheral
,
IPeripheralProvider
public static void registerTurtleUpgrade(ITurtleUpgrade upgrade)
upgrade
- The turtle upgrade to register.ITurtleUpgrade
public static void registerBundledRedstoneProvider(IBundledRedstoneProvider handler)
handler
- The bundled redstone provider to register.IBundledRedstoneProvider
public static int getBundledRedstoneOutput(World world, BlockPos pos, EnumFacing side)
world
- The world this block is in.pos
- The position this block is at.side
- The side to extract the bundled redstone output from.IBundledRedstoneProvider
public static void registerMediaProvider(IMediaProvider handler)
IMedia
implementations for Itemshandler
- The media provider to register.IMediaProvider
public static void registerPermissionProvider(ITurtlePermissionProvider handler)
handler
- The turtle permission provider to register.ITurtlePermissionProvider
public static void registerPocketUpgrade(IPocketUpgrade upgrade)
public static IPacketNetwork getWirelessNetwork()
null
if it could not be fetched.