public final class IMC
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
blacklistHost(java.lang.String name,
java.lang.Class host,
net.minecraft.item.ItemStack stack)
Blacklist an item for a specified host.
|
static void |
blacklistPeripheral(java.lang.Class peripheral)
Blacklist a ComputerCraft peripheral from being wrapped by OpenComputers'
built-in driver for ComputerCraft peripherals.
|
static void |
registerAssemblerFilter(java.lang.String callback)
Register a callback that is used as a filter for assembler templates.
|
static void |
registerAssemblerTemplate(java.lang.String name,
java.lang.String select,
java.lang.String validate,
java.lang.String assemble,
java.lang.Class host,
int[] containerTiers,
int[] upgradeTiers,
java.lang.Iterable<org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.Integer>> componentSlots)
Register a new template for the assembler.
|
static void |
registerCustomPowerSystem()
Notifies OpenComputers that there is some 3rd-party power system present
that adds integration on its side.
|
static void |
registerDisassemblerTemplate(java.lang.String name,
java.lang.String select,
java.lang.String disassemble)
Register a new template for the disassembler.
|
static void |
registerInkProvider(java.lang.String callback)
Register a provider for ink usable in the 3D printer.
|
static void |
registerItemCharge(java.lang.String name,
java.lang.String canCharge,
java.lang.String charge)
Register a handler for items that can be charged.
|
static void |
registerProgramDiskLabel(java.lang.String programName,
java.lang.String diskLabel,
java.lang.String... architectures)
Register a mapping of program name to loot disk.
|
static void |
registerToolDurabilityProvider(java.lang.String callback)
Register a callback for providing tool durability information.
|
static void |
registerWrenchTool(java.lang.String callback)
Register a callback handling a wrench tool.
|
static void |
registerWrenchToolCheck(java.lang.String callback)
Register a callback for checking if an item is a wrench.
|
public static void registerAssemblerFilter(java.lang.String callback)
boolean callback(ItemStack stack)Callbacks must be declared as packagePath.className.methodName. For example: com.example.Integration.callbackMethod.
callback
- the callback to register as a filtering method.public static void registerAssemblerTemplate(java.lang.String name, java.lang.String select, java.lang.String validate, java.lang.String assemble, java.lang.Class host, int[] containerTiers, int[] upgradeTiers, java.lang.Iterable<org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.Integer>> componentSlots)
boolean select(ItemStack stack) Object[] validate(IInventory inventory) Object[] assemble(IInventory inventory)Values in the array returned by validate must be one of the following:
// Valid or not. new Object[]{Boolean} // Valid or not, text for progess bar. new Object[]{Boolean, IChatComponent} // Valid or not, text for progess bar, warnings for start button tooltip (one per line). new Object[]{Boolean, IChatComponent, IChatComponent[]}Values in the array returned by assemble must be one of the following:
// The assembled device. new Object[]{ItemStack} // The assembled device and energy cost (which also determines assembly duration). new Object[]{ItemStack, Number}Callbacks must be declared as packagePath.className.methodName. For example: com.example.Integration.callbackMethod.
name
- the name of the device created using the
template. Optional, only used in logging.select
- callback used to determine if the template
applies to a base item. For example, the robot
template returns true from this if the passed
item stack is a computer case.validate
- callback used to determine if the template
configuration is valid. Once a template is
valid assembly can be started, but not before.assemble
- callback used to apply a template and create a
device from it.host
- the class of the device being assembled, i.e.
the host class for the components being
installed in the device. Used for filtering
eligible components. See blacklistHost(java.lang.String, java.lang.Class, net.minecraft.item.ItemStack)
.containerTiers
- the tiers of the container slots provided by the
template. The length determines the number of
containers. Maximum number is three.upgradeTiers
- the tiers of the upgrade slots provided by the
template. The length determines the number of
upgrades. Maximum number is nine.componentSlots
- the types and tiers of component slots provided by
this template. May contain null entries
to skip slots (slots are ordered top-to-bottom,
left-to-right). For example, a robot template
with only two card slots will pass null
for the third component slot. Up to nine.public static void registerDisassemblerTemplate(java.lang.String name, java.lang.String select, java.lang.String disassemble)
boolean select(ItemStack stack) Object disassemble(ItemStack stack, ItemStack[] ingredients)Where the
Object
returned from the disassemble
method must be one of the following:
ItemStack[]
: list of resulting items, subject to random failure.Object[]{ItemStack[],ItemStack[]}
: two lists of resulting items, the first being subject to
random failure, the second being guaranteed drops (e.g. for item inventory contents).name
- the name of the handler (e.g. name of the item
being handled). Optional, only used in logging.select
- callback used to determine if the template
applies to an item.disassemble
- callback used to apply a template and extract
ingredients from an item.public static void registerToolDurabilityProvider(java.lang.String callback)
double callback(ItemStack stack)Callbacks must be declared as packagePath.className.methodName. For example: com.example.Integration.callbackMethod.
callback
- the callback to register as a durability provider.public static void registerWrenchTool(java.lang.String callback)
boolean callback(EntityPlayer player, BlockPos pos, boolean changeDurability)Callbacks must be declared as packagePath.className.methodName. For example: com.example.Integration.callbackMethod.
callback
- the callback to register as a wrench tool handler.public static void registerWrenchToolCheck(java.lang.String callback)
boolean callback(ItemStack stack)Callbacks must be declared as packagePath.className.methodName. For example: com.example.Integration.callbackMethod.
callback
- the callback to register as a wrench tool tester.public static void registerItemCharge(java.lang.String name, java.lang.String canCharge, java.lang.String charge)
boolean canCharge(ItemStack stack) double charge(ItemStack stack, double amount, boolean simulate)Callbacks must be declared as packagePath.className.methodName. For example: com.example.Integration.callbackMethod.
name
- the name of the energy system/item type handled.canCharge
- the callback to register for checking chargeability.charge
- the callback to register for charging items.public static void registerInkProvider(java.lang.String callback)
int callback(ItemStack stack)Callbacks must be declared as packagePath.className.methodName. For example: com.example.Integration.callbackMethod.
callback
- the callback to register as an ink provider.public static void blacklistPeripheral(java.lang.Class peripheral)
peripheral
- the class of the peripheral to blacklist.public static void blacklistHost(java.lang.String name, java.lang.Class host, net.minecraft.item.ItemStack stack)
Tablet
.name
- the name of the component being blacklisted.host
- the class of the host to blacklist the component for.stack
- the item stack representing the blacklisted component.public static void registerCustomPowerSystem()
public static void registerProgramDiskLabel(java.lang.String programName, java.lang.String diskLabel, java.lang.String... architectures)
.lua
extension.
The list of architectures is optional, if it is not specified this mapping
will be made available to all architectures. It allows filtering since
typically programs will be written for one specific architecture type, e.g.
Lua programs will not (directly) work on a MIPS architecture. The name
specified is the in the Architecture.Name
annotation of the architecture (also shown in the CPU tooltip).
The architecture names for Lua are Lua 5.2
, Lua 5.3
and LuaJ
for example.programName
- the name of the program.diskLabel
- the label of the disk the program is on.architectures
- the names of the architectures this entry applies to.