Should fix tablet disassembly ignoring upgrade container, closes #1838.

This commit is contained in:
Florian Nücke 2016-05-30 20:36:37 +02:00
parent ce77d77baf
commit 9acb5eb26f
2 changed files with 11 additions and 3 deletions

View File

@ -166,9 +166,17 @@ public final class IMC {
* Signature of callbacks must be:
* <pre>
* boolean select(ItemStack stack)
* ItemStack[] disassemble(ItemStack stack, ItemStack[] ingredients)
* Object disassemble(ItemStack stack, ItemStack[] ingredients)
* </pre>
* <p/>
* Where the <code>Object</code> returned from the <code>disassemble</code>
* method must be one of the following:
* <ul>
* <li><code>ItemStack[]</code>: list of resulting items, subject to random failure.</li>
* <li><code>Object[]{ItemStack[],ItemStack[]}</code>: two lists of resulting items, the first being subject to
* random failure, the second being guaranteed drops (e.g. for item inventory contents).</li>
* </ul>
* <p/>
* Callbacks must be declared as <tt>packagePath.className.methodName</tt>.
* For example: <tt>com.example.Integration.callbackMethod</tt>.
*

View File

@ -57,9 +57,9 @@ object TabletTemplate extends Template {
def disassemble(stack: ItemStack, ingredients: Array[ItemStack]) = {
val info = new TabletData(stack)
val itemName = Constants.ItemName.TabletCase(info.tier)
Array(api.Items.get(itemName).createItemStack(1)) ++ info.items.collect {
(Array(api.Items.get(itemName).createItemStack(1), info.container.orNull) ++ info.items.collect {
case Some(item) => item
}.drop(1) // Screen.
}.drop(1) /* Screen */).filter(_ != null)
}
def register() {