blob: 282eac6c1210bd33a609839b222c3ba4d20b4aae [file] [log] [blame] [raw]
package li.cil.oc.common.template
import cpw.mods.fml.common.event.FMLInterModComms
import li.cil.oc.api
import li.cil.oc.util.ItemUtils
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
import scala.language.postfixOps
object NavigationUpgradeTemplate {
def selectDisassembler(stack: ItemStack) = api.Items.get(stack) == api.Items.get("navigationUpgrade")
def disassemble(stack: ItemStack, ingredients: Array[ItemStack]) = {
val info = new ItemUtils.NavigationUpgradeData(stack)
ingredients.map {
case part if part.getItem == net.minecraft.init.Items.filled_map => info.map
case part => part
}
}
def register() {
// Disassembler
{
val nbt = new NBTTagCompound()
nbt.setString("name", "Navigation Upgrade")
nbt.setString("select", "li.cil.oc.common.template.NavigationUpgradeTemplate.selectDisassembler")
nbt.setString("disassemble", "li.cil.oc.common.template.NavigationUpgradeTemplate.disassemble")
FMLInterModComms.sendMessage("OpenComputers", "registerDisassemblerTemplate", nbt)
}
}
}