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 IWiredNode |
createWiredNodeForElement(IWiredElement element)
Construct a new wired node for a given wired element
|
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 IWiredElement |
getWiredElementAt(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.EnumFacing side)
Get the wired network element for a block in world
|
static IPacketNetwork |
getWirelessNetwork()
Attempt to get the game-wide wireless network.
|
static boolean |
isInstalled() |
static void |
registerAPIFactory(ILuaAPIFactory upgrade) |
static void |
registerBundledRedstoneProvider(IBundledRedstoneProvider provider)
Registers a bundled redstone provider to provide bundled redstone output for blocks.
|
static void |
registerMediaProvider(IMediaProvider provider)
Registers a media provider to provide
IMedia implementations for Items |
static void |
registerPeripheralProvider(IPeripheralProvider provider)
Registers a peripheral provider to convert blocks into
IPeripheral implementations. |
static void |
registerPermissionProvider(ITurtlePermissionProvider provider)
Deprecated.
Prefer using
TurtleBlockEvent or the standard Forge events. |
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 provider)
IPeripheral implementations.provider - 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 provider)
provider - 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 provider)
IMedia implementations for Itemsprovider - The media provider to register.IMediaProvider@Deprecated
public static void registerPermissionProvider(@Nonnull
ITurtlePermissionProvider provider)
TurtleBlockEvent or the standard Forge events.provider - The turtle permission provider to register.ITurtlePermissionProviderpublic static void registerPocketUpgrade(@Nonnull
IPocketUpgrade upgrade)
public static IPacketNetwork getWirelessNetwork()
null if it could not be fetched.public static void registerAPIFactory(@Nonnull
ILuaAPIFactory upgrade)
@Nonnull public static IWiredNode createWiredNodeForElement(@Nonnull IWiredElement element)
element - The element to construct it forIWiredSender.getNode()@Nullable public static IWiredElement getWiredElementAt(@Nonnull net.minecraft.world.IBlockAccess world, @Nonnull net.minecraft.util.math.BlockPos pos, @Nonnull net.minecraft.util.EnumFacing side)
world - The world the block exists inpos - The position the block exists inside - The side to extract the network element fromIWiredSender.getNode()