Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
imc [2014/08/29 21:59]
sangar created
imc [2014/08/30 18:32]
sangar
Line 42: Line 42:
 - Assembly callback: `Object[] assemble(IInventory inventory)`  ​ - Assembly callback: `Object[] assemble(IInventory inventory)`  ​
   Values in the returned array: the ItemStack to produce and a Double value, indicating the energy to consume (and thus the time it takes to build the object).   Values in the returned array: the ItemStack to produce and a Double value, indicating the energy to consume (and thus the time it takes to build the object).
-- Slot validator: `boolean validate(IInventory inventory, int slot, ItemStack stack)` ​  +- Slot validator: `boolean validate(IInventory inventory, int slot, int tier, ItemStack stack)` ​  
-  Where `inventory` is the inventory of the assembler, `slot` is the slot index the item stack `stack` should be inserted into.+  Where `inventory` is the inventory of the assembler, `slot` is the slot index the item stack `stack` should be inserted into, and `tier` is the tier specified in template'​s NBT for the slot.
  
 Inventory Layout Inventory Layout
Line 92: Line 92:
  
 Be careful to use a separate NBT compound for each registered template, since they are evaluated when the IMC message is received by OC, which happens asynchronously at a later point in time. Be careful to use a separate NBT compound for each registered template, since they are evaluated when the IMC message is received by OC, which happens asynchronously at a later point in time.
 +
 +For a "​reference"​ implementation,​ see how the [robot templates are implemented](https://​github.com/​MightyPirates/​OpenComputers/​blob/​master/​src/​main/​scala/​li/​cil/​oc/​common/​template/​RobotTemplate.scala).