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(net.minecraft.world.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(net.minecraft.world.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(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.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()
@Nonnull public static java.lang.String getInstalledVersion()
@Nonnull public static java.lang.String getAPIVersion()
public static int createUniqueNumberedSaveDir(@Nonnull
net.minecraft.world.World world,
@Nonnull
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)@Nullable public static IWritableMount createSaveDirMount(@Nonnull net.minecraft.world.World world, @Nonnull 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@Nullable public static IMount createResourceMount(@Nonnull java.lang.Class<?> modClass, @Nonnull java.lang.String domain, @Nonnull 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),
IMountpublic static void registerPeripheralProvider(@Nonnull
IPeripheralProvider handler)
IPeripheral implementations.handler - The peripheral provider to register.IPeripheral,
IPeripheralProviderpublic static void registerTurtleUpgrade(@Nonnull
ITurtleUpgrade upgrade)
upgrade - The turtle upgrade to register.ITurtleUpgradepublic static void registerBundledRedstoneProvider(@Nonnull
IBundledRedstoneProvider handler)
handler - The bundled redstone provider to register.IBundledRedstoneProviderpublic static int getBundledRedstoneOutput(@Nonnull
net.minecraft.world.World world,
@Nonnull
net.minecraft.util.math.BlockPos pos,
@Nonnull
net.minecraft.util.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.IBundledRedstoneProviderpublic static void registerMediaProvider(@Nonnull
IMediaProvider handler)
IMedia implementations for Itemshandler - The media provider to register.IMediaProviderpublic static void registerPermissionProvider(@Nonnull
ITurtlePermissionProvider handler)
handler - The turtle permission provider to register.ITurtlePermissionProviderpublic static void registerPocketUpgrade(@Nonnull
IPocketUpgrade upgrade)
public static IPacketNetwork getWirelessNetwork()
null if it could not be fetched.