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. Alternatively, register a MediaProvider.

  • Method Summary

    Modifier and Type
    Method
    Description
    default Mount
    createDataMount(net.minecraft.world.item.ItemStack stack, net.minecraft.server.level.ServerLevel level)
    If this disk represents an item with data (like a floppy disk), get a mount representing it's contents.
    default net.minecraft.sounds.SoundEvent
    getAudio(net.minecraft.world.item.ItemStack stack)
    If this disk represents an item with audio (like a record), get the resource name of the audio track to play.
    default String
    getAudioTitle(net.minecraft.world.item.ItemStack stack)
    If this disk represents an item with audio (like a record), get the readable name of the audio track.
    getLabel(net.minecraft.world.item.ItemStack stack)
    Get a string representing the label of this item.
    default boolean
    setLabel(net.minecraft.world.item.ItemStack stack, String label)
    Set a string representing the label of this item.
  • Method Details

    • getLabel

      @Nullable String getLabel(net.minecraft.world.item.ItemStack stack)
      Get a string representing the label of this item. Will be called via disk.getLabel() in lua.
      Parameters:
      stack - The ItemStack to inspect.
      Returns:
      The label. ie: "Dan's Programs".
    • setLabel

      default boolean setLabel(net.minecraft.world.item.ItemStack stack, @Nullable 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

      @Nullable default String getAudioTitle(net.minecraft.world.item.ItemStack stack)
      If this disk represents an item with audio (like a record), get the readable name of the audio track. ie: "Jonathan Coulton - Still Alive"
      Parameters:
      stack - The ItemStack to modify.
      Returns:
      The name, or null if this item does not represent an item with audio.
    • getAudio

      @Nullable default net.minecraft.sounds.SoundEvent getAudio(net.minecraft.world.item.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 modify.
      Returns:
      The name, or null if this item does not represent an item with audio.
    • createDataMount

      @Nullable default Mount createDataMount(net.minecraft.world.item.ItemStack stack, net.minecraft.server.level.ServerLevel level)
      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 modify.
      level - 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 mount returned also implements WritableMount, it will mounted using mountWritable()
      See Also: