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
tutorial:modding_imc [2014/10/10 18:10]
sangar created
tutorial:modding_imc [2015/04/23 16:06]
sangar
Line 34: Line 34:
 ``` ```
  
-Callbacks 
---------- 
 Signatures for callbacks: Signatures for callbacks:
  
Line 71: Line 69:
 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 a stack can be disassembled. 
 +  disassemble:​ `String` // Name of static method to call to to get results for a disassembly operation. 
 +
 +```
  
-- `ItemStack[] disassemble(ItemStack stack)` ​  +Signatures for callbacks:​ 
-  ​Return null if the stack is not handled.+ 
 +- `boolean select(ItemStack stack)` ​  
 +  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 98:
 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);
 ``` ```