dan200.computer.api
Interface IMedia


public interface IMedia

Represents an item that can be placed in a disk drive and used by a Computer. Implement this interface on your Item class to allow it to be used in the drive.


Method Summary
 IMount createDataMount(ItemStack stack, World world)
          If this disk represents an item with data (like a floppy disk), get a mount representing it's contents.
 java.lang.String getAudioRecordName(ItemStack stack)
          If this disk represents an item with audio (like a record), get the resource name of the audio track to play.
 java.lang.String getAudioTitle(ItemStack stack)
          If this disk represents an item with audio (like a record), get the readable name of the audio track.
 java.lang.String getLabel(ItemStack stack)
          Get a string representing the label of this item.
 boolean setLabel(ItemStack stack, java.lang.String label)
          Set a string representing the label of this item.
 

Method Detail

getLabel

java.lang.String getLabel(ItemStack stack)
Get a string representing the label of this item. Will be called vi disk.getLabel() in lua.

Parameters:
stack - The itemstack to inspect
Returns:
The label. ie: "Dan's Programs"

setLabel

boolean setLabel(ItemStack stack,
                 java.lang.String label)
Set a string representing the label of this item. Will be called vi disk.setLabel() in lua.

Parameters:
stack - The itemstack to modify.
label - The string to set the label to.
Returns:
true if the label was updated, false if the label may not be modified.

getAudioTitle

java.lang.String getAudioTitle(ItemStack stack)
If this disk represents an item with audio (like a record), get the readable name of the audio track. ie: "Jonathon Coulton - Still Alive"

Parameters:
stack - The itemstack to inspect.
Returns:
The name, or null if this item does not represent an item with audio.

getAudioRecordName

java.lang.String getAudioRecordName(ItemStack stack)
If this disk represents an item with audio (like a record), get the resource name of the audio track to play.

Parameters:
stack - The itemstack to inspect.
Returns:
The name, or null if this item does not represent an item with audio.

createDataMount

IMount createDataMount(ItemStack stack,
                       World world)
If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will be mounted onto the filesystem of the computer while the media is in the disk drive.

Parameters:
stack - The itemstack to inspect.
world - The world in which the item and disk drive reside.
Returns:
The mount, or null if this item does not represent an item with data. If the IMount returned also implements IWritableMount, it will mounted using mountWritable()
See Also:
IMount, IWritableMount, ComputerCraftAPI#createSaveDirMount(World, String), ComputerCraftAPI.createResourceMount(Class, String, String)