Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
tutorial:modding_imc [2015/01/14 23:41]
127.0.0.1 external edit
tutorial:modding_imc [2015/04/23 16:10]
sangar
Line 8: Line 8:
 ``` ```
 { {
 +  name : `String` // Optional, name of the template, used in logging only.
   select : `String` // Name of a static method that's queried to determine whether the template applies to an item stack.   select : `String` // Name of a static method that's queried to determine whether the template applies to an item stack.
   validate : `String` // Name of static method to call for checking if assembly may be started. Returns additional lines for the assemble button and text for the status bar.   validate : `String` // Name of static method to call for checking if assembly may be started. Returns additional lines for the assemble button and text for the status bar.
   assemble : `String` // Name of a static method that is called to create the resulting ItemStack and energy to consume.   assemble : `String` // Name of a static method that is called to create the resulting ItemStack and energy to consume.
-  ​hostName ​: `String` // Name of a class or interface that is the environment or implemented by the environment that will represent the assembled device. Passed to HostAware drivers.+  ​hostClass ​: `String` // Name of a class or interface that is the environment or implemented by the environment that will represent the assembled device. Passed to HostAware drivers.
   componentSlots : `NBTTagList` {   componentSlots : `NBTTagList` {
     `NBTTagCompound` {     `NBTTagCompound` {
Line 34: Line 35:
 ``` ```
  
-Callbacks 
---------- 
 Signatures for callbacks: Signatures for callbacks:
  
Line 71: Line 70:
 Tiers are simply numeric, starting with `0` as tier 1 and ending with `2` as tier 3. `Int.MaxInt` / `Integer.MAX_VALUE` indicate "any tier", meaning no tier indicator will be shown in the GUI slot. Tiers are simply numeric, starting with `0` as tier 1 and ending with `2` as tier 3. `Int.MaxInt` / `Integer.MAX_VALUE` indicate "any tier", meaning no tier indicator will be shown in the GUI slot.
  
-Disassembly ​(Not yet implemented)+Disassembly
 ----------- -----------
-`registerDisassemblerHandler` takes one String, which is the name of a static ​function with the following format:+`registerDisassemblerTemplate` takes an NBT tag with the following format: 
 +``` 
 +
 +  ​name : `String` // This is optional, used only in logging. 
 +  select : `String` // Name of static method to call for checking if stack can be disassembled. 
 +  disassemble : `String` // Name of static ​method to call to to get results for a disassembly operation. 
 +
 +``` 
 + 
 +Signatures for callbacks:
  
-- `ItemStack[] disassemble(ItemStack stack)` ​  +- `boolean select(ItemStack stack)` ​  
-  ​Return null if the stack is not handled.+  Gets the stack to check for validity, returns true if the stack can be disassembled. 
 +- `ItemStack[] disassemble(ItemStack stack, ItemStack[] ingredients)`   
 +  ​Compute ​the items to output from the disassembler for the specified item stack. The passed list of ingredients ​is for convenience,​ and is what OC thinks are the inputs used to craft the passed item stack. The general idea is that you can return that list *plus* additional items, such as stuff that was "​in"​ the passed stack, if the stack has some kind of inventory (e.g. for servers the installed components are also returned).
  
 It will be called whenever *any* item is disassembled,​ and should only return a list of (additional) ingredients where appropriate. It will also be called to check if an item can be disassembled at all. It will be called whenever *any* item is disassembled,​ and should only return a list of (additional) ingredients where appropriate. It will also be called to check if an item can be disassembled at all.
Line 89: Line 99:
 nbt.setString("​assemble",​ "​com.example.mod.Callbacks.ocAssemblerAssemble"​);​ nbt.setString("​assemble",​ "​com.example.mod.Callbacks.ocAssemblerAssemble"​);​
 // ... // ...
-FMLInterModComms.sendMessage("​OpenComputers",​ "registerAssemblerTemplate", nbt);+FMLInterModComms.sendMessage("​OpenComputers",​ "registerDisassemblerTemplate", nbt);
 ``` ```